1、安装依赖:
同时依赖ros1和ros2,所以ros1和ros2的软件源都必须正常,需要依赖的软件包如下:
ros-foxy-rosbag2
ros-foxy-rosbag2-bag-v2-plugins
ros-foxy-rosbag2-compression
ros-foxy-rosbag2-converter-default-plugins
ros-foxy-rosbag2-cpp
ros-foxy-rosbag2-storage
ros-foxy-rosbag2-storage-default-plugin
ros-foxy-rosbag2-test-common
ros-foxy-rosbag2-tests
ros-foxy-rosbag2-transport
ros-foxy-ros2bag
2、数据转换
打开一个终端,先source ros1,然后在source ros2,最后开始转换,具体命令如下:
source /opt/ros/noetic/setup.bash
source /opt/ros/foxy/setup.bash
ros2 bag play -s rosbag_v2 + bag包