Rosbag (ros2 bag)
Definition
A ROS 2 tool that records into a file the data published on topics and services, so that they can be replayed and examined later. It is used to analyse a problem after the fact, to test an algorithm on real data without the robot, or to build datasets.
Checked on against the references below. · Written with AI · checked against the sources Source: Official ROS 2 documentation (Jazzy), “Recording and playing back data”.
Concrete examples
Unitree’s unitree_ros2 repository, which supports the Go2, the B2 and the H1, includes a record_bag module among its examples, described as a bag recording example.
What it changes for you
The storage format is chosen at recording time (--storage option): rosbag2 provides two plugins, mcap (the default on the development branch) and sqlite3. By default, the sqlite3 settings are tuned for speed, at the risk of corrupting bag data after an application or system crash; the resilient profile (--storage-preset-profile option) reduces this risk. The message serialization format is a separate setting: if none is given, ros2 bag record -a records in the middleware’s own format, and such a bag is hard to replay with another middleware.
Additional material checked on .