53 const mbf_msgs::RecoveryGoal &goal = *goal_handle.getGoal();
54 mbf_msgs::RecoveryResult result;
55 result.used_plugin = goal.behavior;
56 bool recovery_active =
true;
60 while (recovery_active &&
ros::ok())
62 state_recovery_input = execution.
getState();
63 switch (state_recovery_input)
72 result.outcome = mbf_msgs::RecoveryResult::STOPPED;
73 result.message =
"Recovery has been stopped!";
74 goal_handle.setAborted(result, result.message);
75 recovery_active =
false;
86 ROS_INFO_STREAM(
"Recovery behavior \"" << goal.behavior <<
"\" patience exceeded! Cancel recovering...");
95 recovery_active =
false;
96 result.outcome = mbf_msgs::RecoveryResult::CANCELED;
97 result.message =
"Recovery behaviour \"" + goal.behavior +
"\" canceled!";
98 goal_handle.setCanceled(result, result.message);
103 recovery_active =
false;
106 if (result.message.empty())
108 if (result.outcome < 10)
109 result.message =
"Recovery \"" + goal.behavior +
"\" done";
111 result.message =
"Recovery \"" + goal.behavior +
"\" FAILED";
115 goal_handle.setSucceeded(result, result.message);
120 recovery_active =
false;
121 result.outcome = mbf_msgs::RecoveryResult::INTERNAL_ERROR;
122 result.message =
"Internal error: Unknown error thrown by the plugin!";
123 goal_handle.setAborted(result, result.message);
127 result.outcome = mbf_msgs::RecoveryResult::INTERNAL_ERROR;
128 std::stringstream ss;
129 ss <<
"Internal error: Unknown state in a move base flex recovery execution with the number: " 130 <<
static_cast<int>(state_recovery_input);
131 result.message = ss.str();
133 goal_handle.setAborted(result, result.message);
134 recovery_active =
false;
146 if (!recovery_active)
The recovery execution was canceled.
The recovery behavior plugin is running.
#define ROS_DEBUG_STREAM_NAMED(name, args)
The recovery execution has been initialized.
#define ROS_ERROR_STREAM_NAMED(name, args)
RecoveryAction(const std::string &name, const mbf_utility::RobotInformation &robot_info)
#define ROS_DEBUG_STREAM_THROTTLE_NAMED(rate, name, args)
void run(GoalHandle &goal_handle, AbstractRecoveryExecution &execution)
The recovery behavior execution is done.
AbstractRecoveryExecution::RecoveryState getState()
Returns the current state, thread-safe communication.
boost::cv_status waitForStateUpdate(boost::chrono::microseconds const &duration)
std::string getMessage()
Gets the current plugin execution message.
The recovery execution has been stopped.
RecoveryState
internal state.
#define ROS_FATAL_STREAM_NAMED(name, args)
An internal error occurred.
virtual bool cancel()
Cancel the planner execution. This calls the cancel method of the planner plugin. This could be usefu...
The AbstractRecoveryExecution class loads and binds the recovery behavior plugin. It contains a threa...
#define ROS_INFO_STREAM(args)
bool isPatienceExceeded()
Checks whether the patience was exceeded.
The recovery execution thread has been started.
uint32_t getOutcome()
Gets the current plugin execution outcome.