-
Notifications
You must be signed in to change notification settings - Fork 435
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
Consider renaming rclcpp::ok #3
Comments
I would only provide a single function (not a second one with inverted return value). As long as we only need a boolean return value I would favor a function returning a bool (rather then en enum). We can always revisit the API decision when that becomes the case. Regarding the name |
@wjwwood @dirk-thomas Do you think it's worth iterating over this ticket? |
We should make a decision and then just implement it that way. |
To summarise the relationship between
Today it looks that
|
To conclude (wanted to get that post out before the meeting), my opinion is that if we want to rename I'd vote for keeping it as I considered |
I don't think |
I personally also vote for keeping it as
is well established in the ROS world and users know how to handle it. I am not saying, we couldn't convince them to use |
@Karsten1987 I also think while rclcpp::ok() {
// do awesome stuff
rclcpp::spin_once(node);
} |
I actually don't think that using As @dirk-thomas originally expressed (#3 (comment)), if we change it, I'd prefer while (!rclcpp::is_shutdown()) {
// do stuff
rclcpp::spin_once(node);
} I'll also point out my "aspirational" rclcpp documentation that I try to deal with the "quick shutdown-reinit" case too: |
+1 |
Since interruption doesn't trigger shutdown, I'm not convinced it makes sense to conflate them so explicitly. That doesn't mean we have to differentiate interruption and shutting down, though: As an example of why conflating them is confusing, consider the case where you want to explicitly call shutdown before a main exit, e.g. to deregister our signal handler before exiting, or because you want to call
which, to me, is confusing to see, even if it's not the default usage. I'm not aware of any plans in the future to ever have our signal handler explicitly call shutdown (if there are, then that would change my opinion). However, from the docs you linked to @wjwwood, there is a direct relationship between I can appreciate that it's an aspirational document so my point isn't that it doesn't match the current state of the code today, but that I think there's generally a difference of opinion about what Today |
If that's the case then I'd say it's mostly an oversight, since that is what ROS 1 does, e.g. see the recommendation for a custom signal handler: http://wiki.ros.org/roscpp/Overview/Initialization%20and%20Shutdown#Custom_SIGINT_Handler Also from that page:
So I think that's worth emulating, or at least I don't know why would change that (maybe I just implemented it incorrectly in |
Pass SharedPtrs callback remove functions instead of bare pointers
Signed-off-by: Chris Lalancette <clalancette@openrobotics.org>
That is, make sure to deal with inter-process publishing properly. This requires us to introduce two copies of do_intra_process_and_return_shared(), one of which deals with the ROS Message type and the other that deals with the PublishedType. This is kind of wasteful, and we may get rid of this later on, but this works for now. Signed-off-by: Chris Lalancette <clalancette@openrobotics.org> Make sure to add the appropriate library directory. (ros2#3) Signed-off-by: Chris Lalancette <clalancette@openrobotics.org>
Not sure if this is still being looked at, but I personally think I don't remember where I read it, but a general best practice is to make bools (or functions that return them) "positive" instead of "negative" to simplify use. I've found this extremely helpful, especially when combining them into more complex conditions and not having to work through all the negations in my head. So if you do decide to move away from rclcpp::ok() (which is think is perfectly fine as is) I would suggest something like On a personal library, I have a thread wrapper class, and have function called Only reason I mention is I think there's a bug in the documentation for |
Given that:
I think it is safe to say that we don't have any plans to do this. I'm going to close this out for now, but feel free to reopen if you disagree.
Yes, you are right. The documentation sense is inverted; I'll open a PR to fix that. Thanks for the heads up. |
add flag to ignore local publications
Signed-off-by: Andrew Symington <andrew.c.symington@gmail.com>
Signed-off-by: Andrew Symington <andrew.c.symington@gmail.com>
This issue has been mentioned on ROS Discourse. There might be relevant details there: |
Discussed names were:
bool rclcpp::is_shutdown
andbool rclcpp::is_not_shutdown
bool rclcpp::is_shutting_down
State rclcpp::state
and compare to predefined stateswhile (rclcpp::state() == rclcpp::RUNNING)
while (rclcpp::state() != rclcpp::SHUTDOWN)
The text was updated successfully, but these errors were encountered: