Skip to content

feat(sensors): add Ros2DepthConsumerConfig.frame_delay_ms (configurable depth delay)#135

Merged
kingb merged 1 commit into
amazon-far:dev/tomasz/tracker_servicefrom
kingb:feat/depth-frame-delay-ms
Jun 27, 2026
Merged

feat(sensors): add Ros2DepthConsumerConfig.frame_delay_ms (configurable depth delay)#135
kingb merged 1 commit into
amazon-far:dev/tomasz/tracker_servicefrom
kingb:feat/depth-frame-delay-ms

Conversation

@kingb

@kingb kingb commented Jun 27, 2026

Copy link
Copy Markdown
Contributor

Stacks on #124. Adds a configurable depth latency to Ros2DepthConsumer

Why

Requested frame_delay_ms feature

What

  • task.pyRos2DepthConsumerConfig.frame_delay_ms: float = 0.0. Default 0.0 preserves current freshest-frame behavior, so existing consumers are unaffected.
  • sensors.pyRos2DepthConsumer buffers timestamped frame sets in a ring buffer; get_latest() returns the freshest set at least frame_delay_ms old (None until enough history accrues to honor the delay). The stream-liveness timeout is measured against the newest set, so an intentional delay is never mistaken for a dead publisher.
  • service_node.py — threads frame_delay_ms off task.depth into the consumer constructor (same path the other depth config fields take).
  • test_depth_consumer_delay.py — unit tests for the look-back selection (stubbed monotonic clock, no ROS traffic; importorskip for host envs).

…table depth delay)

The ROS2 depth transport is effectively instantaneous (sub-1ms), but policies
were trained with the on-robot image_server's inherent capture/serve latency
baked in. Re-introduce that as an absolute-ms delay in the consumer so policies
see appropriately-delayed frames without carrying any delay logic themselves.

- task.py: Ros2DepthConsumerConfig.frame_delay_ms (default 0.0 = freshest frame)
- sensors.py: Ros2DepthConsumer buffers timestamped frame sets; get_latest()
  returns the freshest set at least frame_delay_ms old (robust across fps),
  None until enough history accrues. Stream-liveness timeout measured against
  the newest set so the intentional lag isn't mistaken for a dead publisher.
- service_node.py: thread frame_delay_ms off task.depth into the consumer, so
  per-policy presets (e.g. stair_loco) pin the trained delay without touching core.
- test_depth_consumer_delay.py: unit tests for the look-back selection.
@kingb kingb changed the title feat(sensors): add Ros2DepthConsumerConfig.frame_delay_ms (preset-settable depth delay) feat(sensors): add Ros2DepthConsumerConfig.frame_delay_ms (configurable depth delay) Jun 27, 2026
@kingb kingb merged commit 5c14fe2 into amazon-far:dev/tomasz/tracker_service Jun 27, 2026
8 of 9 checks passed
tomasz-lewicki pushed a commit that referenced this pull request Jun 27, 2026
Follow-up to #135: the Static Checks job flagged two ruff issues in the
new test that the merge didn't block on.

- `pytest.raises(ValueError)` -> added `match=` (PT011)
- collapsed the multiline `Ros2DepthConsumer(...)` call (ruff-format)

Test-only; no behavior change.
@kingb kingb deleted the feat/depth-frame-delay-ms branch June 29, 2026 17:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants