Skip to content

Commit

Permalink
fix: the callback was being called even though the updates were frequ…
Browse files Browse the repository at this point in the history
…ent. the cause was ros time not being steady (ptp?)

Signed-off-by: Kenzo Lobos-Tsunekawa <[email protected]>
  • Loading branch information
knzo25 authored and mojomex committed Jun 6, 2024
1 parent 3398471 commit ae0e291
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion nebula_ros/include/nebula_ros/common/watchdog_timer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@ class WatchdogTimer
{
uint64_t now_ns = node_.get_clock()->now().nanoseconds();

bool is_late = (now_ns - last_update_ns_) > expected_update_interval_ns_;
bool is_late = (last_update_ns_ > now_ns)
? false
: (now_ns - last_update_ns_) > expected_update_interval_ns_;

callback_(!is_late);
}
Expand Down

0 comments on commit ae0e291

Please sign in to comment.