Repository navigation
Add rcl_timer_set_on_schedule_change_callback (backport #1352) - #1361
Conversation
A timer on ROS time moves its next call time inside its clock jump callback when the clock jumps backward past the last call time and when ROS time is activated or deactivated. Nothing told an executor that keeps its own copy of the next call time about it: the on reset callback is only called by rcl_timer_reset(), on purpose (#995), so the EventsCBGExecutor in rclcpp kept sleeping until the old deadline. Add a separate callback that is called at exactly those two places, after the new next call time was stored. It is kept apart from the on reset callback because it runs inside the clock jump callback, on the thread and under the locks of whoever set the clock, so a consumer has to handle it without blocking, while a reset callback may lock. Signed-off-by: Yadunund Vijay <[email protected]> (cherry picked from commit 0224ede) # Conflicts: # rcl/src/rcl/timer.c # rcl/src/rcl/timer_impl.h
|
Cherry-pick of 0224ede has failed: To fix up this pull request, you can check it out locally. See documentation: https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/checking-out-pull-requests-locally |
Signed-off-by: Alejandro Hernandez Cordero <[email protected]>
|
Pulls: #1361 |
|
Pulls: ros2/rclcpp#3404, #1361 |
Description
Helps address ros2/rclcpp#3342
ROS time jumps can change a timer's next call time without notifying the executor. This causes
EventsCBGExecutorto miss timer updates after backward/clockjumps or whenuse_sim_timeis toggled.This PR adds
rcl_timer_set_on_schedule_change_callback()to notify consumers when a timer's next call time changes due to:No ABI changes.
Is this user-facing behavior change?
Yes. Enables executors to correctly reschedule timers after ROS time changes, preventing timers from stalling.
Did you use Generative AI?
Yes. Claude Fable 5.1
Additional Information
Tests:
test_timertests pass.ament_uncrustifyandament_cpplintpass.This is an automatic backport of pull request Add rcl_timer_set_on_schedule_change_callback #1352 done by Mergify.