Skip to content

Record and replay Bag files in ROS

Suryansh Agarwal edited this page Oct 19, 2017 · 1 revision

Maintainers:Suryansh Agarwal, Akash Kumar Singh

HOW TO RECORD AND REPLAY BAG FILES

  1. Make a directory for storing the bag files mkdir ~/bagfiles
  2. Move into the directory cd ~/bagfiles

For recording all the topics

  • Run the command rosbag record -a.
  • A bag file will be created with a name that begins with the year, date, and time and the suffix .bag.
  • We can get details about the bag file by the command rosbag info <bag file>.This will give information about the topics and the number of messages recorded.

For recording specific topics

  • Run the command rosbag record -O subset /topic1 /topic2
  • This will record all the data published on the topic1 and topic2 and save it in subset.bag

Now for playing back the rosbag file run rosbag play <your bagfile>

NOTE: All the data recorded will be published on the specified topic.

For tutorials, click here