Skip to content

Capture context

A recording holds more than sensor readings. Next to each capture, Quatern Code keeps a context file: what the ROS 2 graph looked like while it was recorded. quatern diagnose replays fixes through it, and quatern bringup runs its ROS checks on it.

The file is <capture_id>.context.json, next to the capture in ~/.quatern/captures/ (schema quatern.capture_context, version 1). It's optional: a capture without one still verifies and deploys exactly as before.

Where it comes from

quatern capture on a ROS 2 target takes a snapshot of the graph when the recording starts:

  • ros2 node list;
  • ros2 topic info -v for each topic: publishers and subscribers, with each one's QoS;
  • ros2 param dump for the sensor drivers, the localization nodes and the Nav2 servers.

Besides the robot's sensor topics, it records /tf, /tf_static, /rosout, /diagnostics, /robot_description and /clock, then builds the context from the bag and the snapshot. QoS comes from the snapshot, because rosbag2's offered_qos_profiles is often empty and never names subscribers.

A rosbag you recorded yourself (quatern diagnose --bag DIR) gets a context from the bag alone, without the graph or parameters.

The built-in simulator writes the graph a real robot with this config would have: each sensor on the topic and message type its ROS 2 target names, stamped in its URDF link; sensor data best-effort, odometry and TF reliable, static TF and the robot description transient-local; /clock and use_sim_time. So a fix can be checked on a simulator recording too.

What it holds

Every section is either filled in or explicitly marked {"absent": "<why>"}. Nothing is guessed.

Section What's recorded
streams Per topic: message type, frame_id, rate, jitter, header stamp vs receive time, whether stamps only move forward.
graph Nodes, and per topic its publishers and subscribers with their QoS (reliability, durability, history, depth). Remaps are absent: the ROS 2 CLI doesn't report them.
parameters The dumped parameters of drivers, localization and Nav2 servers.
tf Static and dynamic transforms (who publishes each, over what time span) and the robot description.
sensor_info LaserScan angles, ranges and time_increment; CameraInfo resolution and K; IMU and Odometry covariances; Odometry frame_id and child_frame_id.
time use_sim_time per node, whether /clock was present, each sensor's clock offset.
logs /rosout warnings and errors; /diagnostics warnings, errors and stale statuses.

An excerpt from a TurtleBot 3 recording in the simulator:

{
  "schema": "quatern.capture_context",
  "version": 1,
  "capture_id": "turtlebot3_burger.default_2026-10-03_quickstart_hallway_v1",
  "source": "sim2d",
  "streams": [
    {"topic": "/odom", "type": "nav_msgs/msg/Odometry", "frame_id": "odom", "rate_hz": 29.933,
     "jitter_ms": 1.786, "stamp_minus_receive_ms": {"min": -8.85, "median": -4.72, "max": -2.48},
     "stamps_monotonic": true},
    ...
  ],
  "graph": {
    "taken_at": "capture start (simulated)",
    "topics": {
      "/imu": {"type": "sensor_msgs/msg/Imu",
               "publishers": [{"node": "/sim2d", "qos": {"reliability": "best_effort", "durability": "volatile",
                                                         "history": "keep_last", "depth": 5}}], ...}
    }
  },
  "time": {"use_sim_time": {"/sim2d": true, "/robot_state_publisher": true},
           "clock": {"present": true, "count": 12000},
           "clock_offset_ms": {"/odom": -4.72, "/imu": -2.395, "/scan": -13.51}},
  "logs": {"rosout": [], "diagnostics": []}
}

What it's checked against

quatern bringup and quatern diagnose run the same ROS checks on a recording that has a context:

Group Checks
Frames Every recorded frame_id is in the TF tree. Sensor transforms match the URDF within 1 cm and 0.02 rad. REP 105: one parent per frame, odom → base_link from odometry, map → odom from localization.
Topics and QoS Every subscribed topic has a publisher. Reliability and durability are compatible between each subscriber and its publishers, with REP 2003's sensor-data and map QoS as the reference.
Conventions REP 103: radians and metres, unit quaternions. REP 145: gravity at +9.81 on z at rest, orientation covariance −1 when there's no orientation. Covariances not all zero where a node fuses them.
Timing Stamps only move forward; stamp vs receive time is plausible; sensors within 100 ms of each other; TF covers each sensor's stamps.
Logs Errors on /rosout and /diagnostics during the capture.

In bringup, they're the ros groups:

  ros frames
    ok    message frames: every recorded frame (base_scan, imu_link, odom) is in the TF tree
    ok    sensor transforms: 5 static transform(s) match the URDF
    ok    REP 105: map -> odom -> base_link chain is consistent
  ros qos
    ok    subscribed topics: every subscribed topic has a publisher
    ok    QoS compatibility: every subscriber's QoS is compatible with its publishers'
  ros conventions
    ok    /imu: Imu follows REP 103 and REP 145
    ok    /odom: Odometry follows REP 103
    ok    /scan: LaserScan follows REP 103
    ok    transforms: every static rotation is a unit quaternion (a proper, right-handed rotation)
  ros timing
    ok    monotonic stamps: every stream's stamps only move forward
    ok    stamp vs receive: simulated time: stamps are compared with each other, not with the recorder's wall clock
    ok    clock skew: sensors agree within 11 ms
    ok    TF at message stamps: TF covers the stamps of 2 sensor stream(s)
  ros logs
    ok    /rosout and /diagnostics: no errors logged during the capture

In diagnose, failures and warnings become notes on the findings, and errors logged during the capture become a recorded_log_errors finding whose evidence is the log lines themselves.

Checking a fix on the recording

The context is what lets quatern diagnose call a fix verified on recording. It replays the recording through the patched configuration:

  • the frame each recorded sensor message is stamped in must be one TF has (URDF links, view_frames, robot_state_publisher's segments);
  • every topic a node subscribes to must be in the recording;
  • every subscriber that asks for reliable delivery must get it from the QoS the publisher offered.

A fix that changes a driver's frame_id is replayed with the recorded frames read as the new one. If the replay shows the fix wouldn't work, the fix is rejected rather than labelled. With nothing to find, diagnose says what it replayed:

no root cause found in ~/.quatern/robots/turtlebot3_burger.urdf (turtlebot3_burger.default's URDF), recording turtlebot3_burger.default_2026-10-03_quickstart_hallway_v1
note: replayed turtlebot3_burger.default_2026-10-03_quickstart_hallway_v1 through the configuration: frames, topics and QoS agree

A fix is labelled unverified: <why> when there's no recording, when the recording has no frames, topics or QoS (no rosbag2 and no context), or when the cause isn't one a recording can show (a plugin name, an initial pose, a node's clock). See Diagnose a failing launch.

Recordings without a context

Captures from the mock backend, catalog sample recordings and captures made before contexts existed have none. Every ROS-level check then reports not applicable and says what it would need. It never fails:

  ros frames
    n/a   message frames: not applicable: capture c101.default_2026-10-03_sample_v1 has no capture context
    n/a   sensor transforms: not applicable: capture c101.default_2026-10-03_sample_v1 has no capture context
  ...
ready to drive: nothing fails

Verification, the deploy gate and the watchdog don't use the context.