-
Notifications
You must be signed in to change notification settings - Fork 163
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Change next_call_time computation of rcl_timer to always result in a future timestamp #1089
Conversation
I think, I didn't make it clear in the beginning. We have the issue that timer callbacks of our nodes get called twice with the same timestamp regularly when used in simulation with use_sim_time set to true. I tracked down the problem and tried to create a minimal change that fixes it. |
@kohrt thanks for sharing the issue. is that possible to share the reproducible test project? that would be helpful to understand details and do further debug. |
Here is the example project: https://github.com/cellumation/timer_test.git Compile and run
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kohrt thanks for providing the test project, that really helped me to understand.
i did some experimental check and left a couple of comments, could you share your thought?
CC: @ros2/team
…future timestamp ros2/rcl#1089 Signed-off-by: Tomoya Fujita <Tomoya.Fujita@sony.com>
My local test project, see fujitatomoya/ros2_test_prover@544e615 with the following commands, we can reproduce the problem. > colcon build --symlink-install --packages-select prover_rclcpp
### Terminal-1
> ros2 run prover_rclcpp rcl_1089 --ros-args -p use_sim_time:=true --ros-args --log-level debug
### Terminal-2
> ros2 run prover_rclcpp sim_clock_publisher |
Actually, that won't work because we've added some APIs in the meantime. @kohrt Can you please go ahead and rebase this? Once that is done I'll run CI. |
…r_call. If next_call_time equals now, consecutive callback calls with the same timestamp can occur when using sim time. Signed-off-by: Thiemo Kohrt <t.kohrt@cellumation.com>
Should be rebased now. Thanks for the review @fujitatomoya and @clalancette |
In the current implementation
next_call_time
can be equal tonow
after the timer has been called. This can lead to consecutive callback calls with the same timestamp when using sim time.With this change
next_call_time
will always be greater thannow
after the timer has been called.