What is rosbag? How to record and playback ROS topics

[ROS in 5 mins] 045 - What is rosbag? How to record and playback ROS topics

Written by Bayode Aderinola

08/10/2018

Hello ROS Developers! In this video post, we’ll see what rosbag is, what it does, and how to use it to record and playback ROS topics.

Key commands that you will learn: rosbag...

  1. record
  2. play
  3. info

Let’s go!

Step 1: Create a project in Robot Ignite Academy (RIA)

We have the best online ROS courses available in RIA. It helps you learn ROS in the easiest way without setting up a ROS environment locally. The only thing you need is a browser! Create an account here and start to browse the trial course for free now! We’ll use the ROS Basics in 5 Days course as an example today.

Step 2: Record Bag file with rosbag

The ROS Bag is a powerful tool for you to record and playback your simulation. To start the recording all topic available, simply type the following command in the terminal.

rosbag record -a

As an example, we’ll move the turtlebot in the simulation with

roslaunch turtlebot_teleop keyboard_teleop.launch

You can now move around to generate the data. To finish recording, simply press CTRL+C to terminate the rosbag.

Step 3: Play the rosbag bag file

In the video, the recorded bag file is saved as 2018-10-06-05-04-57.bag (be sure to use your own name 🙂 ). To playback, type the following command in a terminal

rosbag play 2018-10-06-05-04-57.bag

You should see the robot moving around as how you did.

If you want to see more information about the .bag file. The following command will print all the topic available in the .bag file.

rosbag info 2018-10-06-05-04-57.bag

Video

See it happening live in this video, in case you are stuck or just want to sit back and watch a “movie” instead!

Want to learn more?

If you are a ROS beginner and want to learn ROS basics fast, we recommend you take any of the following courses on Robot Ignite Academy:

Further resources

ROS Development Studio (ROSDS), another powerful online tool for pushing your ROS learning in a practical way

We love feedback!

Did you like this video? Whatever the case, please leave a comment in the comments section below, so we can interact and learn from each other.

If you want to learn about other ROS topics, please let us know in the comments area and we will do a post or video about it.

Thank you!

Masterclass 2023 batch2 blog banner

Check Out These Related Posts

0 Comments

Submit a Comment

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Pin It on Pinterest

Share This