Class AbstractRecoveryExecution

Inheritance Relationships

Base Type

Class Documentation

class AbstractRecoveryExecution : public mbf_abstract_nav::AbstractExecutionBase

The AbstractRecoveryExecution class loads and binds the recovery behavior plugin. It contains a thread running the plugin, executing the recovery behavior. An internal state is saved and will be pulled by the server, which controls the recovery behavior execution. Due to a state change it wakes up all threads connected to the condition variable.

Public Types

enum RecoveryState

internal state.

Values:

enumerator INITIALIZED

The recovery execution has been initialized.

enumerator STARTED

The recovery execution thread has been started.

enumerator RECOVERING

The recovery behavior plugin is running.

enumerator WRONG_NAME

The given name could not be associated with a load behavior.

enumerator RECOVERY_DONE

The recovery behavior execution is done.

enumerator CANCELED

The recovery execution was canceled.

enumerator STOPPED

The recovery execution has been stopped.

enumerator INTERNAL_ERROR

An internal error occurred.

typedef std::shared_ptr<AbstractRecoveryExecution> Ptr

Public Functions

AbstractRecoveryExecution(const std::string &name, const mbf_abstract_core::AbstractRecovery::Ptr &recovery_ptr, const mbf_utility::RobotInformation::ConstPtr &robot_info, const rclcpp::Node::SharedPtr &node_handle)

Constructor.

Parameters:
  • name – Name of this execution

  • recovery_ptr – Pointer to the recovery plugin

  • robot_info – Current robot state

  • config – Initial configuration for this execution

virtual ~AbstractRecoveryExecution()

Destructor.

bool isPatienceExceeded()

Checks whether the patience was exceeded.

Returns:

true, if the patience duration was exceeded.

virtual bool cancel()

Cancel the planner execution. This calls the cancel method of the planner plugin. This could be useful if the computation takes too much time, or if we are aborting the navigation.

Returns:

true, if the planner plugin tries / tried to cancel the planning step.

AbstractRecoveryExecution::RecoveryState getState()

Returns the current state, thread-safe communication.

Returns:

current internal state

rcl_interfaces::msg::SetParametersResult reconfigure(std::vector<rclcpp::Parameter> parameters)

Reconfigures the current configuration and reloads all parameters. This method is called from a dynamic reconfigure tool.

Parameters:

parameters – Current config parameters.

Protected Functions

virtual void run()

Main execution method which will be executed by the recovery execution thread_.

void handle_thread_interrupted()

Helper method for cleaning up the state when the recovery thread was interrupted.

Protected Attributes

mbf_abstract_core::AbstractRecovery::Ptr behavior_

the current loaded recovery behavior