What is rosbag? How to record and playback ROS topics
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:
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
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
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:
– 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.
- Click to share on Twitter (Opens in new window)
- Click to share on Facebook (Opens in new window)
- Click to share on Reddit (Opens in new window)
- Click to email this to a friend (Opens in new window)
- Click to print (Opens in new window)
- Click to share on Google+ (Opens in new window)
- Click to share on Tumblr (Opens in new window)
- Share on Skype (Opens in new window)
- Click to share on Pinterest (Opens in new window)
- Click to share on WhatsApp (Opens in new window)
- Click to share on Telegram (Opens in new window)