﻿# Rosbag playback rate changes scheduling, not the original sensor header stamp

Keep bag ordering timestamps, playback clock and message header stamps separate when replaying sensor data into filters that also inspect time.

Author: Retrivium team
Updated: 2026-11-06
Canonical URL: https://retrivium.ai/journal/robotics-rosbag-playback-clock-versus-payload-header-stamp/
Language: en

## An old sensor stamp can arrive during a new replay

A filter rejects replayed camera messages as old even though they have just arrived. The operator increases the playback rate, expecting the timestamp to become current. That changes the wrong boundary. A recorded message can be delivered now while still describing an earlier sensor observation. Establish which clock the filter uses for age and which field it compares before changing rate, rewriting stamps or declaring the bag corrupt. Receipt time alone does not redefine the represented acquisition event.

## Bag ordering is not the embedded header timestamp

The reviewed [rosbag README](https://raw.githubusercontent.com/ros2/rosbag2/rolling/README.md) describes ordering by reception or publication timestamps. Those storage-level choices should not be silently equated with a sensor message’s header. The [Header definition](https://raw.githubusercontent.com/ros2/common_interfaces/rolling/std_msgs/msg/Header.msg) makes stamp part of the message itself. A driver can define what that stamp represents under its sensor contract. Preserve storage timing and payload timing separately when diagnosing relative order or an apparent offset. A matching field type is not proof of the same observation boundary.

## The player has a separate rate-controlled clock

In the reviewed [player implementation](https://raw.githubusercontent.com/ros2/rosbag2/rolling/rosbag2_transport/src/rosbag2_transport/player.cpp), set_rate updates the playback clock. Ordinary topic publication forwards serialized message data. That path does not make rate selection a general header-rewriting operation. The implementation also exposes pre-publication callbacks, so qualify this statement to ordinary replay without an explicit payload-changing extension. If a wrapper deliberately transforms stamps, retain the original and document the mapping instead of attributing the change to playback speed alone.

## Simulation time must be selected by the consumer

Optional publication on /clock supplies a playback-time reference; its existence does not prove every consumer uses that clock. Inspect each relevant node’s clock selection and the application’s age comparison. Mixing a historical header with present system time can produce rejection even when playback is behaving as configured. Conversely, adopting simulation time does not repair a driver stamp from another clock domain. Declare the expected relationship rather than assuming all timestamps become synchronized because they travel through the same replay.

## Compare content and scheduling independently

Propose a passive bag with identifiable stamped sensor messages. Replay it at different supported rates without payload-changing callbacks. Compare message identity and embedded stamps, while measuring arrival scheduling with an independent observation clock. Record whether the consumer uses playback time. Acceptance requires the declared payload preservation and a correctly explained scheduling change. No recorder, player or filter was run here. The fixture does not establish real-time performance, absence of dropped messages or equivalence to the original physical acquisition pipeline.

## Keep the replay contract with evaluation results

[CogVideoX playback accounting](/journal/fg2-cogvideox-generated-latent-frames-playback-rate/) concerns a different timing transformation. [RH20T source and query times](/journal/fg2-rh20t-aligned-query-not-simultaneous-sensor-acquisition/) preserves related measurement provenance. A ROS evaluation record should state ordering reference, replay rate, clock selection and any explicit stamp transformation. That makes a stale-data rejection or successful replay interpretable. It does not permit replacing historical acquisition time with receipt time silently or claiming physical timing fidelity from a replay that merely completed.
