Skip to content

Report zero timestamps even when no valid timestamp arrived - #672

Open
tomek89wo-ops wants to merge 1 commit into
ros:ros2from
tomek89wo-ops:fix/timestamp-status-zero-only
Open

tomek89wo-ops wants to merge 1 commit into
ros:ros2from
tomek89wo-ops:fix/timestamp-status-zero-only

Conversation

@tomek89wo-ops

Copy link
Copy Markdown

TimeStampStatus only checks zero_seen when at least one non-zero timestamp arrived in the period. If a source publishes only zero stamps (for example a driver that never fills header.stamp), run() reports WARN "No data since last update.", does not increment "Zero seen diagnostic update count", and then resets zero_seen, so the zero-stamp detection is lost.

This moves the zero_seen check out of that branch in both the C++ and the Python implementation, and adds a test for a period that contains only zero stamps to both test suites. Behaviour for future, past and valid timestamps is unchanged.

Testing: the Python change was run against the real _update_functions.py with the ROS dependencies stubbed out — the new case fails before the change (WARN, counter 0) and passes after it, and the existing cases still pass. The C++ change mirrors the Python one, but I could not build it locally, so I am relying on CI for it.

Disclosure: this change was prepared with AI assistance (Claude), as noted in the commit trailer.

TimeStampStatus only evaluated zero_seen inside the branch taken when at
least one non-zero timestamp was received in the period. When a source
publishes only zero stamps (e.g. a driver that never fills header.stamp),
run() reported WARN "No data since last update.", did not increment the
"Zero seen diagnostic update count", and then reset zero_seen, so the
detection was discarded.

Move the zero_seen check out of that branch in both the C++ and Python
implementations, and add a test for a period containing only zero stamps.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.

1 participant