feat(sensors): add Ros2DepthConsumerConfig.frame_delay_ms (configurable depth delay)#135
Merged
kingb merged 1 commit intoJun 27, 2026
Conversation
…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.
tomasz-lewicki
approved these changes
Jun 27, 2026
5c14fe2
into
amazon-far:dev/tomasz/tracker_service
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stacks on #124. Adds a configurable depth latency to
Ros2DepthConsumerWhy
Requested frame_delay_ms feature
What
task.py—Ros2DepthConsumerConfig.frame_delay_ms: float = 0.0. Default0.0preserves current freshest-frame behavior, so existing consumers are unaffected.sensors.py—Ros2DepthConsumerbuffers timestamped frame sets in a ring buffer;get_latest()returns the freshest set at leastframe_delay_msold (Noneuntil enough history accrues to honor the delay). The stream-livenesstimeoutis measured against the newest set, so an intentional delay is never mistaken for a dead publisher.service_node.py— threadsframe_delay_msofftask.depthinto 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;importorskipfor host envs).