ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | Q&A
Ask Your Question

Converting ROS2 bag to ROS1 bag?

asked 2020-05-16 00:14:35 -0600

mandymandymandy gravatar image

Is there an existing tool to convert rosbags generated with ROS2 (dashing) to ROS1 format rosbags?

edit retag flag offensive close merge delete


Did you make it?

daniel.tian gravatar image daniel.tian  ( 2021-09-29 00:44:29 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2021-10-12 05:04:53 -0600

gvdhoorn gravatar image

I haven't tested it myself, but there's a chance you could use ternaris/rosbags for this.

Announcement on ROS Discourse: Rosbags - the pure python library for everything rosbag.

There doesn't appear to be any implementation for ROS2->ROS1, but ROS1->ROS2 is there, and the library itself is capable of reading/writing both ROS1 and ROS2 bags.

edit flag offensive delete link more


@gvdhoorn: Thanks! I was able to convert a ros2 bag file to ros1 bag file using ternaris/rosbags and was able to play it in ROS1 as well.

dvy gravatar image dvy  ( 2022-06-30 08:35:14 -0600 )edit

@mandymandy: Can you please tell me how did you do it? Because by following the ternaris/rosbags instructions. I am unable to run it. Also I am very new to ROS . I also want to do the same i.e. convert ROS2 bag(.db3 bag files) to ROS1(.bag files)

draj gravatar image draj  ( 2022-11-07 07:01:27 -0600 )edit

pip install rosbags

Convert "bar", result will be "bar.bag"

rosbags-convert bar
dvy gravatar image dvy  ( 2022-11-07 09:40:08 -0600 )edit

@dvy Thank you very much, it worked. The bag files are converted but there is one more problem, I can see that bag file is reading but I cannot visualize anything on Rviz.

draj gravatar image draj  ( 2022-11-07 14:43:52 -0600 )edit

@draj: No problem. For this, you need to check if your bag file has the required messages using rosbag info bagfile.bag, then try to play it and echo the topic. If you get the data on terminal, it should be some minor setting issue on rviz. All the best!

dvy gravatar image dvy  ( 2022-11-07 15:25:30 -0600 )edit

@dvy Thank you once again. I already did that, as mentioned above I can see the topics and also getting the data on the terminal but rviz is not having the same frame id. I am trying to work on it. I hope I solve the error. Is it fine if I question again, if it doesn't work?

draj gravatar image draj  ( 2022-11-07 15:33:27 -0600 )edit

@draj: Its completely fine to ask questions but I would suggest you to raise another question for that in order to avoid mixing up responses here.

dvy gravatar image dvy  ( 2022-11-07 15:43:06 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools



Asked: 2020-05-16 00:14:35 -0600

Seen: 1,020 times

Last updated: Oct 12 '21