Hi all! This is a post to let anyone interested know that there is now a draft pull request open to switch the default storage plugin for recording in Rolling from SQLite3 to MCAP. There is still work to complete before this merges, but we’re aiming to have it merged by the end of this year (with plenty of time to test before ROS 2 Iron is released).
TL; DR
-
This PR adds rosbag2_storage_mcap to the rosbag2 meta-package dependencies, and changes default
--storage-id
argument to “mcap” when recording withros2 bag record
. -
MCAP file format offers several benefits over the current default, SQLite3.
-
This change affects Iron and future distributions only. No changes for users of Foxy, Galactic or Humble
-
If you rely on SQLite3-specific features such as:
- querying bags directly with SQL statements
- Using message-level compression
You can preserve existing behavior when upgrading to Iron by explicitly setting
--storage-id sqlite3
. -
There is a TODO list in the PR description of issues to be addressed before merging - if you know of anything not on that list, please comment on the PR.
Summary of changes
- Add
rosbag2_storage_mcap
as a dependency of rosbag2_default_plugins- This makes the mcap storage plugin a transitive dependency of the
rosbag2
package, which means it will be installed by default when installing ROS2 Iron. - The SQLite3 storage plugin will continue to be installed by default as well.
- This makes the mcap storage plugin a transitive dependency of the
- Switch default argument for
ros2 bag record –storage-id
fromsqlite3
tomcap
- This means that if you don’t specify a storage plugin to record with, your bags will be recorded in the MCAP format instead of SQLite3.
- If you explicitly specify your storage plugin with
--storage-id
, nothing will change for you.
Reason for change
MCAP is now technically superior to SQLite3 in most ways for bag recording. @john-at-foxglove.dev gave a talk at ROSCon 2022 which goes through some of the major advantages:
- Benchmarking shows that MCAP provides higher throughput for most common workloads
- More configuration options for writing
- More efficient compression using chunked compression
- Easier to use with external tooling due to self-describing nature
User Impact
- This does not affect users of Foxy, Galactic, or Humble. This change would only merge into the Rolling tree and would appear in the Iron distro next year.
- Users of Foxy, Galactic, and Humble may opt in to using MCAP by installing the
rosbag2_storage_mcap
package and passing the--storage-id mcap
argument toros2 bag
.
- Users of Foxy, Galactic, and Humble may opt in to using MCAP by installing the
- Rosbag2 is designed to automatically select the correct storage plugin for the file when reading, so any tools for reading bags that use the rosbag2 API will continue to work seamlessly.
- Most external tools for examining SQLite3 bag contents (such as PlotJuggler and Foxglove Studio) can read MCAP.
- If you have workflows for reading bag contents that directly use SQL statements, these will not work with MCAP files. If you need to keep using those, make sure to explicitly specify the SQLite3 storage plugin when recording with the
--storage-id sqlite3
argument. - MCAP is not compatible with
--compression-mode message
. The reason is that MCAP is designed to be self-describing, and message-level compression breaks this (see this github issue for more details).- MCAP instead supports chunk compression, which batches several messages in each compressed block. This dramatically increases compression efficiency for bags with many small messages.
- If your workflow depends on using message-level compression, make sure to explicitly specify the SQLite3 storage plugin with
--storage-id sqlite3
.
What’s happening now?
There is a TODO list in the PR description of issues to be addressed before merging - if you know of anything not on that list, please comment on the PR.