MCAP as the ROS 2 Default Bag Format

Record ROS 2 data in more performant and configurable bag file format
James SmithJames Smith ·
Esther WeonEsther Weon ·
3 min read
Published

We’re excited to announce that ROS 2 users can now record their data directly to MCAP files, for easy analysis with third-party integrations and developer tools.

rosbag2 now sets the rosbag2_storage_mcap plugin as the default storage format. Starting from the ROS 2 Iron Irwini release (coming in May 2023), you can record ROS 2 data to MCAP (.mcap) files by default, or opt to still use the fully supported SQLite3 (.db3) format.

Community-led development

This work is the culmination of a large community-led effort to improve existing tools for the next generation of ROS 2 users, and we’ve prioritized making this change as seamless as possible for the community.

We had the privilege of collaborating with ROS 2 maintainers at Open Robotics and Apex AI to add this out-of-the-box support for MCAP. As members of the ROS 2 Technical Steering Committee, we’re committed to continually improving ROS and making open source robotics development easier for all.

Check out our comparison of rosbag2 storage plugins for our extensive profiling of MCAP and SQLite3 performance.

Recording

SQLite3, the current ROS 2 recording format default, has a few limitations around recording efficiency and playback, which are addressed by MCAP. When recording, the SQLite3 storage plugin typically uses a “write optimized” mode – this achieves high write throughput at the risk of data corruption if recording is interrupted. This can be changed to a “resilient mode”, which removes the risk of corruption at the cost of write throughput. With MCAP, you can enjoy the data safety of SQLite3’s “resilient” mode, while also achieving the write throughput of its “write optimized” mode.

The MCAP storage plugin provides ROS 2 users with several configuration options for tuning the recorder. For example, you can choose between zstd and lz4 compression options, depending on your compute and compression needs.

Finally, MCAP files are fully self-contained, making it possible to use with third-party tools outside of the ROS environment. By including all necessary message definitions, MCAP files can easily be integrated with tools like Foxglove Studio or PlotJuggler, as they have the message definitions and information needed to decode the file.

Playback

When you now run $ ros2 bag play <PATH_TO_FILE> to play back ROS 2 data files, it will automatically detect whether the file was recorded in MCAP or SQLite3 and decode as needed:

$ ros2 bag play <PATH_TO_FILE>

It’s important to note that rqt_bag can also now handle both rosbag2 storage backends equally well.

Stay tuned

While there are no plans to deprecate SQLite3 support in ROS 2, we hope that the inclusion of MCAP as the default recording format going forward will simplify development and solve pain points for many robotics teams. And because MCAP is flexible enough to record heterogeneous data (e.g. ROS 1, ROS 2, Protobuf, JSON, FlatBuffers, etc.) in a single file, it can adapt to your team's framework choices and evolving data stack.

As you get started with this new recording format, we’d love to hear your feedback! Join the conversation in our Slack community or on Twitter, or check out the MCAP GitHub repo to file feature requests.


Read more:

Understanding ROS Transforms
tutorial
ROS
Understanding ROS Transforms

Defining how objects in a robot's world relate to each other.

Esther WeonEsther WeonEsther Weon
José L. MillánJosé L. MillánJosé L. Millán
5 min read
Announcing FlatBuffers Support in Foxglove
tutorial
studio
data platform
MCAP
Announcing FlatBuffers Support in Foxglove

Analyze your FlatBuffers data with Foxglove Studio and Data Platform.

Sam NosenzoSam NosenzoSam Nosenzo
6 min read

Get blog posts sent directly to your inbox.

Ready to get started?Download today on Linux, Windows, or macOS.