-
Notifications
You must be signed in to change notification settings - Fork 433
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
Create common structures for executors to use #2143
Conversation
d77bac1
to
d53349a
Compare
Signed-off-by: Michael Carroll <[email protected]>
Signed-off-by: Michael Carroll <[email protected]>
d53349a
to
9099635
Compare
Signed-off-by: Michael Carroll <[email protected]>
* Add callback to EntitiesCollector constructor * Make function to check automatically added callback groups take a list Signed-off-by: Michael Carroll <[email protected]>
Signed-off-by: Michael Carroll <[email protected]>
rclcpp/include/rclcpp/executors/executor_entities_collector.hpp
Outdated
Show resolved
Hide resolved
rclcpp/include/rclcpp/executors/executor_entities_collection.hpp
Outdated
Show resolved
Hide resolved
Signed-off-by: Michael Carroll <[email protected]>
Signed-off-by: Michael Carroll <[email protected]>
Signed-off-by: Michael Carroll <[email protected]>
Also change node's get_guard_condition to return shared_ptr Signed-off-by: Michael Carroll <[email protected]>
3b7266c
to
a6c4c1b
Compare
Check if guard condition is valid before adding it to the waitable Signed-off-by: Michael Carroll <[email protected]>
Signed-off-by: Michael Carroll <[email protected]>
Signed-off-by: Michael Carroll <[email protected]>
Signed-off-by: Michael Carroll <[email protected]>
Signed-off-by: Michael Carroll <[email protected]>
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.
I did a pretty thorough review and I didn't really see any issues. I assume a lot of them have been ironed out by the tests and existing applications which exercise it well.
lgtm
/** | ||
* TODO(mjcarroll): Assert this when we are enforcing that nodes must be destroyed | ||
* after their created callback groups. | ||
RCLCPP_EXPECT_THROW_EQ( | ||
entities_collector.remove_callback_group(cb_group), | ||
std::runtime_error("Node must not be deleted before its callback group(s).")); | ||
*/ |
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.
How do we enforce this? Or when do you think this TODO could be resolved?
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.
Maybe my understanding is incorrect, but should a callback group be allowed to exist without being created by a node?
If callback groups can exist independently, and outlive their creating node, then this todo is resolved by simply never doing this check, because it is based on an invalid assumption.
If callback groups should not outlive their creating node, then maybe the API should be updated to not return SharedPtr
and instead use WeakPtr
, which we could then check here.
Windows unfortunately has a bunch of new failures that probably need to be looked into. They were not in the nightlies. (for that matter, we should also probably run CI on Windows Debug to see what it has to say here) |
Yeah, I'm looking into them. |
@mjcarroll Given our long discussion yesterday, where are we with this PR? I think we came to the conclusion that we have a flaky test in |
The test in |
@ros-pull-request-builder retest this please |
* Deprecate callback_group call taking context * Add base executor objects that can be used by implementors * Template common operations * Add callback to EntitiesCollector constructor * Make function to check automatically added callback groups take a list * Make executor own the notify waitable * Add pending queue to collector, remove from waitable Also change node's get_guard_condition to return shared_ptr * Change interrupt guard condition to shared_ptr Check if guard condition is valid before adding it to the waitable * Make get_notify_guard_condition follow API tick-tock * Improve callback group tick-tocking * Add thread safety annotations and make locks consistent * Remove the "add_valid_node" API * Only notify if the trigger condition is valid * Only trigger if valid and needed Signed-off-by: Michael Carroll <[email protected]>
* Deprecate callback_group call taking context * Add base executor objects that can be used by implementors * Template common operations * Add callback to EntitiesCollector constructor * Make function to check automatically added callback groups take a list * Make executor own the notify waitable * Add pending queue to collector, remove from waitable Also change node's get_guard_condition to return shared_ptr * Change interrupt guard condition to shared_ptr Check if guard condition is valid before adding it to the waitable * Make get_notify_guard_condition follow API tick-tock * Improve callback group tick-tocking * Add thread safety annotations and make locks consistent * Remove the "add_valid_node" API * Only notify if the trigger condition is valid * Only trigger if valid and needed Signed-off-by: Michael Carroll <[email protected]>
* Deprecate callback_group call taking context * Add base executor objects that can be used by implementors * Template common operations * Add callback to EntitiesCollector constructor * Make function to check automatically added callback groups take a list * Make executor own the notify waitable * Add pending queue to collector, remove from waitable Also change node's get_guard_condition to return shared_ptr * Change interrupt guard condition to shared_ptr Check if guard condition is valid before adding it to the waitable * Make get_notify_guard_condition follow API tick-tock * Improve callback group tick-tocking * Add thread safety annotations and make locks consistent * Remove the "add_valid_node" API * Only notify if the trigger condition is valid * Only trigger if valid and needed Signed-off-by: Michael Carroll <[email protected]>
* Deprecate callback_group call taking context * Add base executor objects that can be used by implementors * Template common operations * Add callback to EntitiesCollector constructor * Make function to check automatically added callback groups take a list * Make executor own the notify waitable * Add pending queue to collector, remove from waitable Also change node's get_guard_condition to return shared_ptr * Change interrupt guard condition to shared_ptr Check if guard condition is valid before adding it to the waitable * Make get_notify_guard_condition follow API tick-tock * Improve callback group tick-tocking * Add thread safety annotations and make locks consistent * Remove the "add_valid_node" API * Only notify if the trigger condition is valid * Only trigger if valid and needed Signed-off-by: Michael Carroll <[email protected]>
* Deprecate callback_group call taking context * Add base executor objects that can be used by implementors * Template common operations * Add callback to EntitiesCollector constructor * Make function to check automatically added callback groups take a list * Make executor own the notify waitable * Add pending queue to collector, remove from waitable Also change node's get_guard_condition to return shared_ptr * Change interrupt guard condition to shared_ptr Check if guard condition is valid before adding it to the waitable * Make get_notify_guard_condition follow API tick-tock * Improve callback group tick-tocking * Add thread safety annotations and make locks consistent * Remove the "add_valid_node" API * Only notify if the trigger condition is valid * Only trigger if valid and needed Signed-off-by: Michael Carroll <[email protected]>
* Deprecate callback_group call taking context * Add base executor objects that can be used by implementors * Template common operations * Add callback to EntitiesCollector constructor * Make function to check automatically added callback groups take a list * Make executor own the notify waitable * Add pending queue to collector, remove from waitable Also change node's get_guard_condition to return shared_ptr * Change interrupt guard condition to shared_ptr Check if guard condition is valid before adding it to the waitable * Make get_notify_guard_condition follow API tick-tock * Improve callback group tick-tocking * Add thread safety annotations and make locks consistent * Remove the "add_valid_node" API * Only notify if the trigger condition is valid * Only trigger if valid and needed Signed-off-by: Michael Carroll <[email protected]>
Broken off of #2142 so that it can be used as a base for #2140.
This introduces a few main structures:
CC: @alsora @mauropasse