How it works…

First of all, we will learn how to record some data as an example—we will use our program4 node, which was discussed in the previous section  Inspecting and diagnosing the ROS system . We will first launch the node as follows:

$ roslaunch chapter4_tutorials program4.launch

At the moment, we have two options: first, to record all the topics, and second, to record selective topics as follows, respectively:

$ rosbag record -a $ rosbag record /temperature

Once the experiment is completed, we can terminate the recording by hitting Ctrl + C in the running terminal.

We can explore more options with the rosbag help record, which includes the bag file size, the duration of the recording, options to split the files into several smaller ...

Get Robot Operating System Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.