-
Notifications
You must be signed in to change notification settings - Fork 227
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
avoid lifecycle node transition exception #1319
base: rolling
Are you sure you want to change the base?
avoid lifecycle node transition exception #1319
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.
with this fix, we can avoid the crash on action server from exception and the action client can receive the response with failure as below.
root@tomoyafujita:~/ros2_ws/colcon_ws# ros2 run lifecycle_py lifecycle_talker
[WARN] [1721693858.103483007] [rcl_lifecycle]: No transition matching 2 found for current state unconfigured
[ERROR] [1721693858.114465029] [lc_talker]: Unable to start transition 2 from current state (1, 'unconfigured')
root@tomoyafujita:~/ros2_ws/colcon_ws# ros2 service call /lc_talker/change_state lifecycle_msgs/srv/ChangeState "{transition: {id: 2}}"
requester: making request: lifecycle_msgs.srv.ChangeState_Request(transition=lifecycle_msgs.msg.Transition(id=2, label=''))
response:
lifecycle_msgs.srv.ChangeState_Response(success=False)
@mjforan @Barry-Xu-2018 @chrisbitter if any of you can do the review or test, that will be really appreciated. |
About __change_state(), my understanding is
So, when returning from __change_state(), we need to ensure that the state machine is in a primary state, not a transition state (such as configuring, cleaningup, shuttingdown, etc). If trigger_transition_by_id/trigger_transition_by_label throw exception, it should call on_error and then switch to unconfigured or finalized state. Is my understanding correct? Besides, __change_state() may be executed concurrently (the program modifies the state while an external process modifies the state through |
Testing the basic I agree with @Barry-Xu-2018; the exception should not be handled the same way for all three instances.
|
If bad state change is called, a Python lifecycle node will crash. Until this PR (ros2/rclpy#1319) is merged, this is a workaround.
@mjcarroll @sloretz @ahcorde can you take a look when you have time? |
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.
There are some conflict to resolve
@ahcorde appreciate your time for the review, thanks! yeah, i will do rebase and resolve the conflict, and get back to you. |
Signed-off-by: Tomoya Fujita <[email protected]>
Signed-off-by: Tomoya Fujita <[email protected]>
2b1611e
to
f76104b
Compare
@Barry-Xu-2018 about your comment on #1319 (comment) makes sense. (including locking mechanism) AFAIS, current PR is aligned with |
Pulls: #1319 |
addresses #1209
replaces #1317