-
Notifications
You must be signed in to change notification settings - Fork 442
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
feat: Add ClockWaiter and ClockConditionalVariable #2691
Conversation
This pull request has been mentioned on ROS Discourse. There might be relevant details there: https://discourse.ros.org/t/next-client-library-wg-meeting-friday-6th-december-2024-8am-pt/40954/2 |
Assigned @wjwwood, and recommend Client Library Working group review 🧇 |
rclcpp/src/rclcpp/clock.cpp
Outdated
|
||
|
||
bool | ||
wait_until_ros_time(std::unique_lock<std::mutex>& lock, |
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.
Add documentation.
Especially document that system time will be used if ros time is not active
7cd8101
to
90acb47
Compare
f4070bc
to
e16b8f9
Compare
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.
@jmachowinski do we need to review this?
#2674 includes pretty much everything here?
This is the rolling version of general useful code used in 2674. |
Ah, i missed that, sorry. |
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.
Those classes have been already approved in jazzy to fix the action expired goal synchronization, so it will be better to keep those classes in rolling for maintainability.
i would like to request another review for this. CC: @alsora @mjcarroll @wjwwood
The changes look good. |
e16b8f9
to
6ea93b4
Compare
I added tests, and fixed a bug that I found through this... |
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.
lgtm with green CI.
Pulls: #2691 |
6ea93b4
to
f6e8920
Compare
This PR now depends on ros2/rcpputils#210 |
f6e8920
to
137152c
Compare
Pulls: #2691 |
Pulls: #2691 |
Added two new synchronization primitives to perform waits using an rclcpp::Clock. Signed-off-by: Janosch Machowinski <[email protected]>
Signed-off-by: Janosch Machowinski <[email protected]>
137152c
to
86514fe
Compare
Pulls: #2691 |
All failures in the CI are unrelated to this PR, I would say we are ready to merge. |
This replaces the Clock::cancel_sleep_or_wait with two new synchronization primitives, that can be instantiated separate from the Clock object.
The old API turned out the be a bad design, as one can not simply copy or create new clock objects.
If one copys a clock object, the same internal pimpl is copied, which is undesirable in combination with this API,
as they then all share the same conditional. Therefore one can't do sleeps with multiple threads without waking up
other threads.
If one tries to create a new clock, then there is no clockprovider registered to it. Leading to an unexpected
behavior in simulation mode. We should perhaps add a BIG warning to the constructor to not do this.
This merge request is a first step in reworking the clock code, and I want to get some feedback on the API / class names, before refactoring further.
@arneboe Can you have a look the documentation and API ?