ros2_control icon indicating copy to clipboard operation
ros2_control copied to clipboard

Exceptions thrown in controllers should never crash the entire framework

Open bmagyar opened this issue 4 years ago • 3 comments

Restrict the scope of exceptions thrown in controllers to those controllers.

General idea: When an exception is thrown in a controller, that controller should go into some failed state. This should impose no additional changes on existing controller code.

Implementation ideas:

  • Add some hooks into controller_interface to do the catching?
  • Add a general try-catch around update() in controller_manager and manage controller state? (Also lays itself well for later to put an entire chain of controllers into error state if one of them fails)

This should help with issues similar to #445 in the future.

bmagyar avatar Jul 05 '21 08:07 bmagyar

I was just looking at it because my controller is crashing everything :D

We can cover all in controller_interface except init call. This is really propagated through inheritance. For other methods, we have on_* controller methods.

destogl avatar Jul 05 '21 15:07 destogl

@Karsten1987 @v-lopez @mahaarbo

bmagyar avatar Jul 07 '21 19:07 bmagyar

I'd go with the general try-catch.

If someone is careful enough to implement a hook that does the exception processing, he should probably catch them at the source.

v-lopez avatar Jul 08 '21 07:07 v-lopez