-
Notifications
You must be signed in to change notification settings - Fork 418
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
Implement Clock::sleep_for
and Clock::sleep_until
#1730
Comments
sleep_for
and sleep_until
functionalityClock::sleep_for
and Clock::sleep_until
I'm planning to work on this right now, wanted to open this issue to track work and hold discussion. I think it makes sense to mostly implement in C++ so that we can take advantage of |
Wow, I forgot that I opened #1730 back in March. Related/identical issue |
(assigned to Emerson since he is actively working on it) |
I'm having some trouble using this feature in practice given the API that we defined. The |
That's interesting. I would have thought sleepimg forever is a desirable feature, like when running nodes against slower-than-real-time simulations. What you describe kind of sounds like "sleep until either of these times are reached on these two clocks". Maybe that use case would be better served with two timers, one using each clock, whose callbacks set a single condition variable? |
Alternatively - instead of "sleep until either of these times are reached" - perhaps exposing a "cancel/interrupt" of some sort would work. Not sure if we would want to expose the I think I have a reasonable way to move forward with the behavior I want to implement in rosbag2, but it's still worth possibly thinking about an interrupt mechanism here. |
Feature request
Feature description
Implement the
sleep_for
andsleep_until
functions specified in the "Clock and Time" design document for ROS 2 https://design.ros2.org/articles/clock_and_time.html#public-apiImplementation considerations
This will probably be best implemented using a
condition_variable
'swait_until
andwait_for
functions.For stead/system time, these can be used, but the CV will need to be interrupted if time source type changes.
For ROS time, the CV can be awakened on receiving new clock samples, in order to check if the latest
/clock
time is >= the requestedsleep_until
time.The text was updated successfully, but these errors were encountered: