ROS bag recording¶
XPARO can record your robot’s ROS 2 topics into ROS bags and upload finished recordings to the project, where they appear in the Sensors database with a download link. Everything on this page was tested on a live robot.
Turn it on¶
Start the robot with record_bags:=true:
ros2 launch xparo xparo_launch.py \
xparo_project_id:=<your-project-id> \
xparo_secret_key:=<your-secret-key> \
record_bags:=true
The launch file then also starts a standard ros2 bag record process
(MCAP storage, each file compressed with zstd) writing under BAG_DIR, and
xparo_ros controls it. Recording does not necessarily start straight away;
that depends on the start mode below.
Note
Without record_bags:=true, xparo_ros can still start and stop a
ros2 bag record you run yourself (it uses the recorder’s standard
services), but it does not upload anything.
When recording starts¶
Start mode |
Behaviour |
|---|---|
Auto Start |
Recording starts when the robot starts, after the optional start delay. |
Wait for Task |
The recorder stays idle until something asks it to start: the
dashboard’s Rosbag panel, or |
Set the mode, the delay and the topics in Database → Sensors → ROS Bag Recording (see Database (Step 4)). These settings are sent to the robots that are online when you press Save Recording Settings; a robot that was offline keeps its previous settings until you save them again while it is online. A freshly installed robot starts in Wait for Task mode.
The start mode and delay apply at once. The topic selection (all topics, all except some, or only some) applies the next time the robot is started.
Start and stop¶
From the dashboard: Robots Fleet → (robot) → Rosbag shows the state, with Start, Stop and Save (which also stops).
From the robot:
ros2 topic pub --once /ros2_bag_control std_msgs/msg/String "data: 'start'"
ros2 topic pub --once /ros2_bag_control std_msgs/msg/String "data: 'stop'"
# where it is now: closed, paused or writing
ros2 topic echo /ros2_bag_control/recording_status
# whether a recorder is running at all
ros2 topic echo /ros2_bag_control/recorder_alive
status writes the state to the node’s log. Each recording is one file, from
start to stop; there is no splitting, so save and split do nothing on
the topic.
Uploads¶
Every 15 seconds the robot looks for finished recordings and uploads them to the project. After the server confirms, the robot deletes its local copy. The recording in progress is never uploaded until it is stopped. The robot’s log shows each step:
[UPLOAD] Attempting: bag_2026_10_06-08_09_08_0.mcap.zstd
[UPLOAD] Metadata status for bag_2026_10_06-08_09_08_0.mcap.zstd: ok
[SUCCESS] Server confirmed receipt. Deleted: bag_2026_10_06-08_09_08_0.mcap.zstd
If the upload fails (no internet, for example), the file stays on the robot and is tried again in the next round. Recordings count towards the project’s storage (see Dashboard (project overview)).
A downloaded recording is a zstd-compressed MCAP file. Decompress it, then use the normal ROS 2 tools (or any MCAP viewer):
zstd -d bag_2026_10_06-08_09_08_0.mcap.zstd
ros2 bag info bag_2026_10_06-08_09_08_0.mcap
ros2 bag play bag_2026_10_06-08_09_08_0.mcap
The Sensors database also keeps a summary of each recording’s metadata (its duration, topics and message counts); click the row to see it.
Disk safety¶
While uploads are on, the robot keeps an eye on the disk that holds
BAG_DIR: when it is more than 90 % full, the oldest recordings are deleted
until it is below 70 %.
Where files go¶
BAG_DIR defaults to <share>/ros_bags with the launch file (see
Configuration). Each recording is a folder named after its start time.
When the recorder starts it always creates a short throwaway file
(boot_session_…); xparo_ros deletes it automatically.