ROS Bag
rosbagCommonROS's data-recording tool, which logs topic messages with timestamps so they can be replayed later.
rosbag is ROS's built-in tool for recording and replaying data. It subscribes to specified topics and writes each message to a file along with its timestamp; on playback, it republishes the messages in their original time order, so downstream nodes behave as if the real robot were running live. ROS 1 uses the .bag format; the ROS 2 counterpart is rosbag2 (the ros2 bag command), which used SQLite storage by default early on and switched to the MCAP format by default starting with the Iron release. It's used to reproduce bugs, debug algorithms offline, and share data, and it's also the raw capture format behind many robot datasets — for imitation learning, the images and joint-state topics in a bag are commonly time-aligned and converted into training formats such as LeRobot or HDF5.
Exampleros2 bag record -a records every topic, ros2 bag info shows the duration and message counts, and ros2 bag play replays it.
- Also called
- ros2 bag, rosbag2, bag file
- Related
- MCAP · Topic (ROS) · Trajectory / Episode Replay · Multi-sensor Time Synchronization / Timestamp Alignment · LeRobotDataset · Foxglove Studio
- Sources
- ROS 2 Documentation: Recording and playing back data
ros2/rosbag2 - GitHub