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

How to read ROS2 bag file in ROS1?

asked 2021-10-12 04:56:41 -0600

Mobile_robot gravatar image


I would like to convert a ROS2 bag file (.db3) to ROS1 bag file (.bag). This question has been asked before but we no answer so I decided to repeat it by adding another question as well.

also, is it possible to read the ROS2 bag file within ROS1? I have found a plugin which does the inverse but I did not find anything related to what I need.

Any idea? Thanks,

edit retag flag offensive close merge delete


You already found #q352466 yourself. Please don't post duplicates.

gvdhoorn gravatar image gvdhoorn  ( 2021-10-12 05:01:53 -0600 )edit

I am sorry, but as an admin you should be more careful. This is NOT the same question. Please read carefully the Titles. This is the question on how READING the robag2 file within ROS1. But inside of this question, the previous question on how to CONVERT the ROS2 bag file to ROS1 bag file has been mentioned!

Mobile_robot gravatar image Mobile_robot  ( 2021-10-12 05:10:03 -0600 )edit

I'm not sure I understand your comment (and the caps are not needed).

I'm also not sure whether the distinction between reading and converting is sufficient to warrant a new question.

Part of conversion is reading.

If you really want a separate answer, I'll re-open and post it.

gvdhoorn gravatar image gvdhoorn  ( 2021-10-12 05:25:53 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2021-10-12 05:27:39 -0600

gvdhoorn gravatar image

updated 2021-10-12 05:30:07 -0600

is it possible to read the ROS2 bag file within ROS1?

no, this is not supported right now. rosbag in ROS 1 does not have the same "pluggable storage backend" concept as rosbag in ROS 2 has. That plugin system is what makes the plugin you found work.

Unless someone extends rosbag with this capability of course.

To do that, you could use the Python library mentioned in #q352466 (although the core of rosbag is actually C++), but I doubt it would be trivial to make such a process robust, as the mapping between ROS1<->ROS2 topics is not always obvious (or even feasible).

Extending rosbag is possible though. See ros/ros_comm#1206 and ros/ros_comm#1499 which added bag encryption to rosbag.

edit flag offensive delete link more

Question Tools



Asked: 2021-10-12 04:56:41 -0600

Seen: 729 times

Last updated: Oct 12 '21