Convert ROS1 bag to ROS2 bag

For rosbag files recorded in ROS1 environment, we cannot use them directly in ROS2 environment. There are some discussions on workarounds. In summary, there are two ways, as summarized in this articlearrow-up-right.

Solution 1: Install rosbag_v2 plugin and ros1_bridge

sudo apt-get install ros-$ROS2_DISTRO-ros2bag ros-$ROS2_DISTRO-rosbag2*
sudo apt install ros-$ROS2_DISTRO-rosbag2-bag-v2-plugins
  • We can then playback ros1 bag files in a ros2 environment.

source_ros1
source_ros2
ros2 bag play -s rosbag_v2 V1_01_easy.bag

Additional comments: For Ubuntu 22 or above environment, according to ros2 official docsarrow-up-right, it may be possible to install ros1_bridge alongside ros2, if ros2 is installed from source. In practice, I did not run through this successfully and got stuck at the ros-core-dev : Depends: catkin but it is not installable error.

References:

  • This is a python package that does not depend on ros environment. We can convert a ros1 bag file into ros2 bag by running the following commands.

References:

Last updated

Was this helpful?