ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
3

ROS2 Managed node: triggering an error from primary state

asked 2018-08-31 10:25:11 -0600

Myzhar gravatar image

updated 2018-09-02 11:38:29 -0600

I have a managed node with a thread running when it is in `ACTIVE ' state.

During the execution of the thread an error can occur and I have not understood how to trigger an error event to enter into the on_error callback, manage the error and going back to `UNCONFIGURED ' state if the error can be solved.

on_error callback is executed when a transition callback returns TRANSITION_CALLBACK_ERROR or an unhandled exception is generated... but when the node is in a Primary state?

Thank you Walter

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
1

answered 2018-09-04 16:49:28 -0600

Karsten gravatar image

There is no error handling done when a transition is executed successfully. The underlying state machine only handles the transitions, but not the primary states. So you might want to catch exceptions in your primary states yourself and then trigger a change of state manually. https://github.com/ros2/rclcpp/blob/m...

edit flag offensive delete link more

Comments

The design page speaks about the possibility of entering in 'error handling' from the primary state. Do you think that it will be added?

Myzhar gravatar image Myzhar  ( 2018-09-04 17:04:02 -0600 )edit
1

answered 2020-04-16 09:50:46 -0600

thebyohazard gravatar image

I didn't find this question before I asked my duplicate question, but after digging and finding it impossible, I have created a series of pull requests implementing this functionality: rcl_interfaces#97, rcl#618, rclcpp#1064, and to show how it is used, demos#436.

edit flag offensive delete link more

Comments

I also hope that this issue will be resolved. I believe that this feature is essential for practical use of the Lifecycle.

longjie0723 gravatar image longjie0723  ( 2023-03-31 03:38:23 -0600 )edit

Question Tools

3 followers

Stats

Asked: 2018-08-31 10:25:11 -0600

Seen: 1,448 times

Last updated: Apr 16 '20