[rclcpp_action] Action client holds weak pointers to goal handles#1122
Merged
jacobperron merged 5 commits intomasterfrom May 22, 2020
Merged
[rclcpp_action] Action client holds weak pointers to goal handles#1122jacobperron merged 5 commits intomasterfrom
jacobperron merged 5 commits intomasterfrom
Conversation
Fixes #861 It is against the design of ROS actions to rely on the status topic for the core implementation, instead it should just be used for introspection. Rather than relying on the status topic to remove references to goal handles, the action client instead holds weak pointers to the goal handles. This way as long as a user holds a reference to the goal handle they can use it to interact with the action client. Signed-off-by: Jacob Perron <jacob@openrobotics.org>
jacobperron
commented
May 20, 2020
Signed-off-by: Jacob Perron <jacob@openrobotics.org>
Signed-off-by: Jacob Perron <jacob@openrobotics.org>
Member
Author
Member
Author
|
I'll still have to update the examples that aren't already maintaining a reference to the goal handle. Otherwise, I expect them to break as pointed out in #861 (comment). |
Member
Author
|
So, it turns out this change didn't break our examples, because of a subtle way the lifetime of the goal handle is extended. If the user registers a result callback when sending the goal, then the shared_ptr is kept alive by the action client by passing it to this lambda: rclcpp/rclcpp_action/include/rclcpp_action/client.hpp Lines 633 to 636 in d06e8e0 I guess this is fine, though I think it's worth adding some documentation regarding the lifetime of the goal handle. |
Signed-off-by: Jacob Perron <jacob@openrobotics.org>
wjwwood
approved these changes
May 22, 2020
DensoADAS
pushed a commit
to DensoADAS/rclcpp
that referenced
this pull request
Jul 7, 2020
…s2#1122) * [rclcpp_action] Action client holds weak pointers to goal handles Fixes ros2#861 It is against the design of ROS actions to rely on the status topic for the core implementation, instead it should just be used for introspection. Rather than relying on the status topic to remove references to goal handles, the action client instead holds weak pointers to the goal handles. This way as long as a user holds a reference to the goal handle they can use it to interact with the action client. Signed-off-by: Jacob Perron <jacob@openrobotics.org> * Move cleanup logic to the end of the function Signed-off-by: Jacob Perron <jacob@openrobotics.org> * Add TODO Signed-off-by: Jacob Perron <jacob@openrobotics.org> * Log debug messages when dropping a weak references to goal handles Signed-off-by: Jacob Perron <jacob@openrobotics.org> * Improve documentation Signed-off-by: Jacob Perron <jacob@openrobotics.org>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #861
It is against the design of ROS actions to rely on the status topic for the core implementation,
instead it should just be used for introspection.
Rather than relying on the status topic to remove references to goal handles, the action client
instead holds weak pointers to the goal handles. This way, as long as a user holds a reference to
the goal handle they can use it to interact with the action client.
Draft PR for now as I try to determine if this actually fixes the issue (hopefully with a reliable reproduction of the bug).For a reproduction, see #861 (comment)