ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
1

Converting ROS2 bag to ROS1 bag?

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

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

Comments

Did you make it?

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

1 Answer

Sort by ยป oldest newest most voted
3

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

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

Comments

@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 -0500 )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 -0500 )edit

pip install rosbags

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

rosbags-convert bar
dvy gravatar image dvy  ( 2022-11-07 09:40:08 -0500 )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 -0500 )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 -0500 )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 -0500 )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 -0500 )edit

I get an error while following the above commands Could not read meta data tho i have my yaml file in the same directory

Gutha Bharadwaj gravatar image Gutha Bharadwaj  ( 2023-05-18 03:22:02 -0500 )edit

Question Tools

3 followers

Stats

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

Seen: 3,691 times

Last updated: Oct 12 '21