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.
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
Document issue with shutdown #283
Document issue with shutdown #283
Changes from 1 commit
3766c61
33c4e43
3a419f9
19f709f
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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 think we need to be careful with this advice.
In particular, if you are writing composable nodes, you basically never want to call
rclcpp::shutdown
. That's becauserclcpp::shutdown
is a global operation, and will shut down your node and all other nodes that happen to be composed with your node at the same time. That's probably not what is intended.The composable container should call
rclcpp::shutdown
when it is going down, but that is a different thing.Overall, I'm not saying that you are wrong, but there is subtle distinction here.
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.
Wouldn't composable nodes be created as shared libraries without a
main
function and hence lack the opportunity to invokerclcpp::init()
andrclcpp::shutdown()
? Only executables that implement compile-time composition would include these statements and the advise above should be valid in this scenario?The default
main
impl for composable nodes includes anrclcpp::shutdown()
https://github.com/ros2/rclcpp/blob/a78d0cbd33b8fe0b4db25c04f7e10017bfca6061/rclcpp_components/src/node_main.cpp.in#L78There 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.
Happy to massage the wording in any other way!
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 mean, they shouldn't call it, but that doesn't mean they won't.
rclcpp::shutdown
, in particular, is often (erroneously) called when a node is done with its work; even our demos are guilty of this: https://github.com/ros2/demos/blob/0f2afe53be38b71c01d43f0900e18187d2e36082/demo_nodes_cpp/src/services/add_two_ints_client_async.cpp#L65I'm going to suggest some wording to point out that composable nodes shouldn't generally do this.