You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Add sleep_for and sleep_until for rcl_clock_t as per "Clock and Time" design #898
The design article Clock and Time specifies that the ROS clock API is to have sleep_for and sleep_until methods. These are not yet present (that I know of).
For context - it seems that this feature would be the best option to use for controlling rosbag2 playback time, instead of using std::this_thread::sleep_until in the message playback loop, so that it is more possible to handle time source control such as pausing and alteration of playback speed - as well as listening to an external time source like Gazebo.
Implementation considerations
Likely the existing timer code gives us most of the tools we need to implement this, it uses time sources correctly.
Also a long discussion in ros2/rclcpp#1248. TL;DR, I think the consensus is that we should have a "sleep_until" function that operates on a ROS time object, though the discussion was focused on rclcpp. I don't know how much development overhead is involved in abstracting this feature to rcl; I guess it may be a bit trickier without the convenience of some C++ features.
Sleeping is thread specific, and threads are language specific, so I think it makes sense to implement sleep methods in the language specific client libraries instead of rcl.
This has been implemented in rclcpp - see the related ticket ros2/rclcpp#1730
Activity
fujitatomoya commentedon Mar 10, 2021
this sounds reasonable to me, though it does seem to be really common use case. i wonder there's been similar discussion before... 🤔
jacobperron commentedon Mar 12, 2021
Related ticket: ros2/rclcpp#465
Also a long discussion in ros2/rclcpp#1248. TL;DR, I think the consensus is that we should have a "sleep_until" function that operates on a ROS time object, though the discussion was focused on rclcpp. I don't know how much development overhead is involved in abstracting this feature to
rcl; I guess it may be a bit trickier without the convenience of some C++ features.emersonknapp commentedon Mar 12, 2021
I really only need it in C++ right now for this project, but I'm generally inclined to want
rclpy(et. al) to have features, too.paulsammut commentedon Jul 29, 2021
I just want to be able to sleep for x number of time :(
sloretz commentedon Nov 30, 2021
Sleeping is thread specific, and threads are language specific, so I think it makes sense to implement sleep methods in the language specific client libraries instead of
rcl.This has been implemented in rclcpp - see the related ticket ros2/rclcpp#1730
clalancette commentedon Jun 21, 2022
This was implemented in both rclcpp and rclpy, and it seems like we are not going to do anything further in rcl itself. So closing this out.