A new rosbag player for ROS 2. It solves the problem that the original rosbag player struggles with high-bandwidth data and can't replay multiple rosbags reliably (#2158).
Advantages over the original player (rosbag2)
- Reliably plays multiple Rosbags without starvation issues.
- Improved reading algorithm: - Uses constant time rather than constant message count lookahead when reading, making it independent of frequency differences among topics (#2158).
- Robust and clean asynchronous code. The reader thread sends messages to the publisher thread via message passing, which eliminates starvation and deadlock bugs systematically (such as #2156). Rust's channels are a perfect fit here.
- Overall simpler implementation
It currently supports only the (default) mcap format: If you still have files in the legacy SQLite format, I recommend converting them first to MCAP using rosbags.
First, install Rust/Cargo: https://rust-lang.org/tools/install/
cargo install rustbag
# add cargo bin folder to your path so that the rustbag command is found (add this line your ~/.bashrc)
export PATH=$PATH:~/.cargo/bin/
git clone https://github.com/iv461/rustbag
cd rustbag
cargo install --path .
# add cargo bin folder to your path so that the rustbag command is found (add this line your ~/.bashrc)
export PATH=$PATH:~/.cargo/bin/
You then need to source the ROS environment.
The CLI and the keyboard controls are almost the same as the original rosbag player.
The only difference is that no -i flag is required for multiple rosbag files.
For example:
rustbag path/to/rosbag1 path/to/rosbag2 --clock --topics /sensing/lidar/pointcloud_raw /camera/center/image_rect/compressed --remap /tf:=/tf_old -l -r 0.5
Note: rustbag uses memory mapping for reading the files. This makes it appear to have an unreasonably high memory usage compared to rosbag2.
- Agnostic to the RMW-implementation, i.e. supports CycloneDDS, FastDDs, Zenoh etc.
- Playing Multiple bags
- Playing compressed mcap files (
.mcap.zstd) - Controls: Pause, resume, changing rate, stepping to next message
- Choosing topics to include/exclude, also via regex
- Topic remapping
- Publishing clock (simulated time), filtering clock from bag
- Playing a rosbag in a loop, start offset
- Orders messages by their publish timestamp
- Reads the correct QoS from the bag file
- Choosing frequency of the
/clocktopic
rosbag2 has quite an has an extensive feature set, PRs are welcome to add these missing features:
- Only supports the mcap format
- Replaying services
- Bag split
- Wait for all publishers to receive the ACK (r2r limitation)
- Disabling keyboard controls (Useful only if it was a composable node/module (ros2/rosbag2#1607))
- QoS overrides (but
/tf_staticis always published with correct QoS) - Controlling playback via services
- Delay before start (Just pause before play)
- Start paused (Just pause before play)
- Delay before each message (Just use rate)
- Choosing which topics trigger /clock (I see no use for this feature)
- Does not adapt serialization format: As all DDS-based RMWs as well as Zenoh use the same serialization format (CDR), , this is de facto not a problem
Pull requests for bugfixes and for adding missing features that rosbag2 has are welcome. Please create an issue first to discuss your use-case before creating a pull request.
This software is released under the Apache-2 license.
The Rosbag2 project was a helpful reference for this project, particularly with regard to the keyboard controls and player clock. Rosbag2 is licensed under the Apache-2 licence.
