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 sleep_for and sleep_until for rcl_clock_t as per "Clock and Time" design #898

Closed
emersonknapp opened this issue Mar 9, 2021 · 6 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@emersonknapp
Copy link
Collaborator

emersonknapp commented Mar 9, 2021

Feature request

Feature description

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).

Related to ros2/rosbag2#99

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.

@fujitatomoya
Copy link
Collaborator

this sounds reasonable to me, though it does seem to be really common use case. i wonder there's been similar discussion before... 🤔

@jacobperron
Copy link
Member

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
Copy link
Collaborator Author

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
Copy link

I just want to be able to sleep for x number of time :(

@sloretz
Copy link
Contributor

sloretz commented 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
Copy link
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

6 participants