Skip to content
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

Add RCL_ROS_TIME based timers #440

Closed
matt-attack opened this issue Feb 19, 2018 · 1 comment
Closed

Add RCL_ROS_TIME based timers #440

matt-attack opened this issue Feb 19, 2018 · 1 comment
Labels
enhancement New feature or request

Comments

@matt-attack
Copy link
Contributor

matt-attack commented Feb 19, 2018

Currently there are only wall_time based timers. It would be very useful for bag playback or any other instance that use_sim_time is enabled to have some kind of timer that can use ROS time as a backing. This would allow for pausing the system or slowing it down to match the playback of the bag file.

This would likely require having a thread running in the background monitoring these timers or utilizing Clock::create_jump_callback() to check the timers to see if they need to be executed in any instance rostime jumps. If any are ready you can then somehow mark those timers as ready to be ran by the executor and wake up the spinning thread by issuing a rcl_trigger_guard_condition(); on the node's notify_guard_condition.

This is how I hacked it in externally:
https://github.com/matt-attack/marti_common/blob/2ca02138b2ca25d32a8a5d32737d5a7759b69166/swri_roscpp/include/swri_roscpp/node.h#L86
https://github.com/matt-attack/marti_common/blob/2ca02138b2ca25d32a8a5d32737d5a7759b69166/swri_roscpp/src/node.cpp#L194

@dirk-thomas dirk-thomas added the enhancement New feature or request label Jul 13, 2018
@sloretz
Copy link
Contributor

sloretz commented Sep 21, 2018

I believe this was solved by ros2/rcl#286 which implements something very similar to what you described but in rcl. ROS time timers subscribe to clock jump callbacks and trigger a guard condition that wakes the wait set. Closing.

@sloretz sloretz closed this as completed Sep 21, 2018
nnmm pushed a commit to ApexAI/rclcpp that referenced this issue Jul 9, 2022
Signed-off-by: Abby Xu <abbyxu@amazon.com>
DensoADAS pushed a commit to DensoADAS/rclcpp that referenced this issue Aug 5, 2022
Signed-off-by: Emerson Knapp <eknapp@amazon.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants