What is rosbag? How to record and playback ROS topics

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: 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!

[ROS Q&A] 157 – How to make TurtleBot rotate left and right?

[ROS Q&A] 157 – How to make TurtleBot rotate left and right?

Learn how to make TurtleBot rotate left and right by running the python (.py) file.

In the video, we try to answer the following question posted on the ROS Answers forum: https://answers.ros.org/question/304357/how-to-make-turtlebot-rotate-left-and-right/

RELATED LINKS

Robot Ignite Academy
ROS in 5 Days Course (Python)
ROS Development Studio (ROSDS)
Original question

We Love Feedback
Did you like this video? Do you have questions about what is explained? Whatever the case, please leave a comment on 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 on the comments area and we will do a video about it.

Case Studies – How HKPC learns ROS for their new division of Self-Driving Cars

Case Studies – How HKPC learns ROS for their new division of Self-Driving Cars

HKPC is the Hong Kong Productivity Council, a multi-disciplinary organization which is tasked with promoting and assisting the Hong Kong business sector through the introduction of more efficient and updated business and technological methods.

We interviewed Yiu Chi Wai – Senior Engineer at their Automotive parts and accessories R&D center. We talked about why they were learning ROS and why did they choose to use the Robot Ignite Academy as the way to learn it.

 

What does your company do?

More than a company we are an organization. We provide technical support to Hong Kong companies that want to improve their technology methods.

Why are you learning ROS?

We decide to create a new line of research on autonomous cars, and we believe that self-driving cars are going to be ruled by ROS. Since our team did not have knowledge on ROS, we had to start by learning it, so later we can apply it to the cars.

(photo credit: HKPC)

(photo credit: HKPC)

Which ROS methods have you tried?

We used the official ROS wiki page provided by ros.org and some videos scattered around.

What were you struggling with those learning methods?

The main problem is that the wiki tutorials do not provide a step by step sequence that allows you to understand a subject. It is kind of scattered parts that you later have to put together. And that is difficult as a beginner.

Why did you choose to learn with Robot Ignite Academy?

Mainly for two reasons: one is the interactivity. Since the academy provides simulations of the robots, we can see the result of our programs in real time. Another one is that the tutorials are very well done, step-by-step. The tutorials shows how to do every step until you get the program running on the simulated robot.

I would also say that we liked very much the amount of tutorials that you have showing how to apply ROS to some application (like drones or autonomous cars).

What are you missing at Robot Ignite Academy?

Nothing yet. We started to learn some weeks ago and so far, it has been a nice experience. Actually is not only me who is learning with your academy. We have three other people that started learning ROS in your academy before myself. And next week, another colleague is going to start learning.

Which ROS subjects are you interested in?

At present we are concentrated on learning the ROS basics. Later we may be more interested in learning how to apply ROS to autonomous cars.

Which computer type (O.S.) are you using to learn ROS?

We use Linux machines for programming, but for the learning, we are using Windows computers. It is nice to run ROS on Windows!

Have you applied what you learned to real robots? Which ones?

Not yet. As I mentioned, we are still in the process to build the pieces that we need for the creation of autonomous cars. We already have some cars that we will use in the close future for experimentation, and we will use our ROS skills with them.

(photo credit: HKPC)

(photo credit: HKPC)

Thank you for your time!

And for all of you reading this case study, consider the amount of time you will save if you use the Robot Ignite Academy to train your engineers on ROS based robotics. We have courses for learning the basics of ROS, but we also have more advanced courses that teach how to apply it to self-driving cars, drones, deep learning with robots, Reinforcement Learning applied to ROS robots, industrial robots and many more. Just check our current list of courses in this page and give it a free try.

Other companies that use our academy to train their teams

[ROS Q&A] 156 – JointPositionController does not post on /joint_states topic

[ROS Q&A] 156 – JointPositionController does not post on /joint_states topic

 

This video tries to answer the following question found in the ROS Answers forum

In the video, we’ll follow up the URDF tutorial from the ROS Wiki, explaining all the steps taken so that the /joint_states topic gets published.

 

RELATED RESOURCES

Robot Ignite Academy
Robot Creation with URDF Course
ROS Development Studio (ROSDS)
Original question


Feedback

Did you like this video? Do you have questions about what is explained? Whatever the case, please leave a comment on 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 on the comments area and we will do a video about it.

[ROS Q&A] 155 – How to use callback function in ROS Subscriber

[ROS Q&A] 155 – How to use callback function in ROS Subscriber

 

This video tries to answer the following question found in the ROS Answers forum: https://answers.ros.org/question/303105/how-to-use-callback-with-python/

In the video, we’ll show how to handle and work with callback functions in a ROS Subscriber.

RELATED LINKS

Robot Ignite Academy
ROS Basics Course (Python)
ROS Development Studio (ROSDS)
Original question

We love feedback!

Did you like this video? Do you have questions about what is explained? Whatever the case, please leave a comment on 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 on the comments area and we will do a video about it.

[ROS Q&A] 154 – How to Detect Collisions with static objects in Gazebo

[ROS Q&A] 154 – How to Detect Collisions with static objects in Gazebo

 

In this video, we answer the following question: http://answers.gazebosim.org/question/20432/ros-gazebo-detecting-collision-with-a-static-object-using-contact-sensor/

  • We explain how to set up a robot so that you can detect collisions with static or non-static objects.
  • We concentrate on explaining the strange way in which URDFs are converted to SDF and the naming problems it gives.

Pin It on Pinterest