-
Notifications
You must be signed in to change notification settings - Fork 1
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
refactor: remove lifecycle predicates and add lifecycle state getter #130
Conversation
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 don't think that adding a wrapper enum for the primary states is particularly useful, especially if you hide all the transition states as "UNKNOWN".
I think the main use case for a component to check its own state is during parameter validation callback, which will usually happen during a primary state like inactive. But, this is also something that might feasibly happen during transition states, for example by internally setting a parameter during on_activate
; treating transition states as UNKNOWN states would then make it less clear.
The underlying lifecycle node already has get_current_state()
which you use here, and I think returning the rclcpp_lifecycle::State
is already very useful (because you can get id()
for switch cases and label()
for logging). If you really want, you could just wrap the get_current_state()
method with get_lifecycle_state()
, but keep the same return type.
I would prefer to have this PR just remove the lifecycle predicate.
8616b19
to
d6471b1
Compare
Okay, I added a wrapper. It's just quite complicated to use really IMO because the return type |
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.
it's just quite complicated to use really IMO because the return type
rclcpp_lifecycle::State
is different from the enum typelifecycle_msgs::msg::State::XXX
I do agree that using the lifecycle_msgs::msgs::State::XXX
is quite verbose, but again I wouldn't suggest redefining the existing standard if it leads to a loss of information with no other real gain, especially as we get both id()
and label()
from the State class.
Description
As title suggests.
For the lifecycle state getter, I made an enum in modulo core because I feel like the ROS
PRIMARY_STATE_XXX
is too verbose and has a long name/namespace.Review guidelines
Estimated Time of Review: 10 minutes
Checklist before merging: