Repository navigation
fix: track frame timestamp per-stream in HW clock mode (silences false reset warnings on DDS) - #3531
Merged
remibettan merged 1 commit intoJun 30, 2026
Conversation
…k reset warnings The hardware-clock branch of frameSystemTimeSec compared every incoming frame's timestamp against a single shared _previous_frame_time. With multi-stream sources (e.g. DDS devices, where frames are tagged with RS2_TIMESTAMP_DOMAIN_HARDWARE_CLOCK), frames from different streams running at different rates interleave out of order against that one global value, triggering false "Hardware clock reset detected" warnings and spurious time-base resets on nearly every frame. Make _previous_frame_time a per-stream map keyed by the rs2 stream unique_id, so each stream's monotonicity is checked only against itself. On a real backward jump, clear the map so other streams re-seed silently against the new time base on their next frame. USB devices (GLOBAL_TIME domain) are unaffected — they don't enter this branch. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
remibettan
merged commit Jun 30, 2026
20739e5
into
realsenseai:ros2-development
9 of 10 checks passed
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.
Summary
Fixes a wrapper-side false positive in
BaseRealSenseNode::frameSystemTimeSec()that floods the logs withHardware clock reset detected. Resetting ROS time base.warnings — and forces a spurious time-base rebase on most frames — when running with multi-stream sources that report timestamps inRS2_TIMESTAMP_DOMAIN_HARDWARE_CLOCK(currently: DDS devices, e.g. D555).USB devices report
RS2_TIMESTAMP_DOMAIN_GLOBAL_TIMEand never enter this branch, so they're unaffected.Root cause
_previous_frame_timewas a single shareddoublecompared against the timestamp of every incoming frame regardless of which stream it came from. With multiple streams running at different rates (depth/color/IMU), frames legitimately interleave out of order against that one global value, so the_previous_frame_time > timestamp_mscheck trips on most frames and is interpreted as a hardware clock reset.Fix
Make
_previous_frame_timea per-streamstd::map<int, double>keyed byrs2::stream_profile::unique_id(). Each stream's monotonicity is now checked only against itself. On a genuine backward jump, clear the whole map so other streams re-seed silently on their next frame (the new time base would make their stored "previous" values stale anyway).Validation
Tested on Ubuntu 22.04 / Humble against a D555 over DDS (librealsense 2.59.9 from source).
Before:
Hardware clock reset detectedrepeating continuously throughout the run.After: exactly one
frame's time domain is HARDWARE_CLOCK. Timestamps may reset periodically.informational notice at startup (the expected first-frame seed), and zeroHardware clock reset detectedmessages during steady-state streaming.The remaining log lines from
dds-metadata-syncer/dds-topic-reader/color-formats-converteroriginate in librealsense's DDS layer, not the wrapper, and are out of scope for this PR.Risk
GLOBAL_TIMEpath: untouched (early-out before this branch).🤖 Generated with Claude Code