ROS2 Managed node: on_error

asked 2018-08-30 09:41:21 -0500

Myzhar gravatar image

updated 2018-08-30 09:43:47 -0500

Hi,

writing the code to manage the "Error Processing" transition I can read the "previous" primary state, but I cannot know if the error has been generated during a transition state.

To be mode clear: if I am in "INACTIVE" state and I receive an "ACTIVATE" command I enter in the transition callback on_activate.

If during the activation process an error happens I return TRANSITION_CALLBACK_ERROR and I enter in the on_error callback.

The parameter const rclcpp_lifecycle::State& previous_state of the on_error callback is set to PRIMARY_STATE_INACTIVE and not to TRANSITION_STATE_ACTIVATING.

In this particular case I cannot know if I've entered the on_error callback from TRANSITION_STATE_ACTIVATING, from TRANSITION_STATE_CLEANINGUP or from PRIMARY_STATE_INACTIVE.

Is there a "smart" way to know where I entered the ERROR PROCESSING transition state? I'm using a variable that keep tracks of the previous transition state, but it is not a stable way to understand who generated the error since I can enter the callback also from a primary state...

Thank you Walter

edit retag flag offensive close merge delete

Comments

1

It looks like this is an oversight in the design of the API, I'd recommend opening an issue on ros2/rcl specifically about this. Thanks for the detailed description of the issue you're having. @Karsten FYI

William gravatar imageWilliam ( 2018-10-05 10:23:44 -0500 )edit

The issue has been opened the last month, but in the ros2/rclcpp repository: https://github.com/ros2/rclcpp/issues...

Myzhar gravatar imageMyzhar ( 2018-10-05 10:28:21 -0500 )edit

I noticed that the transition_event topic is well done since it contains start_state and goal_state information. It is a good example of what is really useful

Myzhar gravatar imageMyzhar ( 2018-10-05 10:31:37 -0500 )edit