Skip to content

LifecycleNode: how to manage errors? #547

@Myzhar

Description

@Myzhar

I'm trying to understand how to correctly manage errors in a LifecycleNode.
From what I understood currently the on_error callback is called in two cases:

  1. when a transition callback returns lifecycle_msgs::msg::Transition::TRANSITION_CALLBACK_ERROR
  2. when an uncaught exception is thrown inside a transition callback

But according to ROS2 design page the node should be able to enter in error processing transition also from ACTIVE state.

Now I have two problems:

  1. Understand who generated the error that called on_error since the only argument of the on_error callback is const rclcpp_lifecycle::State& previous_state
  2. Understand how to trigger an error from ACTIVE state (for example from a thread acquiring data from a device, when the device disconnects)

I think that the lifecycle demo should have an example of on_error callback together with the other.

Metadata

Metadata

Assignees

No one assigned

    Labels

    duplicateThis issue or pull request already existsquestionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions