Working with ROS 1/2 Bags
This page serves as a guide to work with ROS Bags on ROS2 Humble.
Last updated
This page serves as a guide to work with ROS Bags on ROS2 Humble.
Last updated
There are some differences between ROS1 and ROS2 messages:
ROS1:
Extension: .bag
Storage: Custom binary format
Tools: rosbag
, rqt_bag
Compression: Supported (e.g., BZ2)
Metadata: Topic names, types, timestamps
ROS2:
Extension: .db3
Storage: SQLite3 database
Tools: ros2 bag
Compression: Supported
Metadata: More flexible and complex metadata
MCAP (Message Capture)
A proposed standard for a unified file format to store serialized messages for robotic systems.
Designed to be flexible, efficient, and language-agnostic.
Aims to standardize message storage across different middleware systems, improving interoperability and performance.
Play Bag using any of the two commands:
Use rqt to view topics,
You can use rosbags-convert tool to unpack ROS1 .bag file to .db3 files that can be played using
ros2 bag play </path/to/bag.db3>
If you want to obtain a .mcap file, we can use rosbag2 to convert .db3 to .mcap.
1.1) Install rosbags library
1.2) Navigate to directory containing .bag and extract .db3 and metadata
If your terminal says "rosbags-convert command not found
". It could be that your rosbags library is installed in a directory that is not included in PATH variable.
Go to your home directory and add the following line into ~/.bashrc. (Replace {user} with your device username)
2.1) Ensure that you have rosbag2 installed
2.2) Write config file for conversion (name of file can differ)
If you want your mcap file to contain all topics and services, write convert.yaml as such:
2.3) Run command to convert