ROS bag

Note

The official documentation for rosbag and rqt_bag are quite comprehensive. Please refer to them if you have any questions.

rosbag is an excellent tool which allows you to record any topics you want during runtime. The recorded topics are saved to a bagfile. These bags can be easily inspected with a rqt_plugin called rqt_bag to plot the data.

../../_images/example_ros_bag.png

Example of rqt_bag

Recording bags

There are many ways to record a rosbag: Using the RQT plugin, with the commandline, or adding it to the launchfile.

Adding it to the launchfile is the least effort, and is done by starting the following node:

<node
  pkg="rosbag"
  name="record"
  type="record"
  output="screen"
  args="-o <output_directory> /topic1 /topic2"
/>

Use the option -a to record all topics.

Hint

If you don’t specify an output directory, the log files are located in the ros home folder (~/.ros)