Robot Data and Event Streams
Camera frames, joint states, commands, and status updates arrive at different
times and in different orders. retriever_typing.data gives every value an
event time and a source so a stream stays deterministic under replay. The types
are immutable dataclasses in registry category data.
Two clocks are always explicit: event_time_ns (what actually happened) and
ingest_time_ns (when the callback fired). Event.ordering_key() sorts by
(event_time, ingest_time, stream_id, seq), so a merge is reproducible even
when two streams share a timestamp.
Deterministic ordering and windows
Section titled “Deterministic ordering and windows”merge_sorted interleaves buffers by event time; latest and window_agg
read from the merged stream by recorded time, not arrival order.
Note the camera event at event=2000 sorts after the joint event at the same
time because its ingest is later — the ordering key is total and stable:
Event-time joins carry lineage
Section titled “Event-time joins carry lineage”The join operators align two streams by recorded time and stamp each result
with a LineageRef naming the source events it came from — so an exported row
can still explain where it came from.
Each joined value keeps lineage=[A:<t>, B:<t>], the exact source timestamps
that produced it:
What each piece is for
Section titled “What each piece is for”| Type / helper | Use it for | Check |
|---|---|---|
Event |
One timestamped value with source metadata. | Event time, ingest time, source, and lineage are explicit. |
EventBuffer |
An immutable event history. | sorted(), within(start, end), and latest_event() are deterministic. |
StreamId |
A stable stream identity. | Non-empty; used in ordering and manifests. |
align_* |
Aligning two streams by event time. | Uses recorded timestamps, not callback timing. |
WindowPolicy |
Aggregating over a temporal slice. | Duration and agg (first/last/max/min/mean) are explicit. |
LineageRef |
Tracking derivation. | Joined/exported values still name their sources. |
Core Retriever owns the runtime event-buffer mechanics and scheduler. GoldenRetriever adds this applied data profile: enough timing and provenance on a camera observation, command, or state estimate to debug it after the fact. It feeds directly into the LeRobot export.
Source: src/retriever_typing/data/ (v1.py, buffer.py, join.py);
demos examples/advanced/robotics_typing_standard/data_spec_eventstream_demo.py,
multi_stream_join_demo.py.
