52 const mbf_msgs::RecoveryGoal &goal = *(goal_handle.
getGoal().get());
53 mbf_msgs::RecoveryResult result;
54 bool recovery_active =
true;
58 while (recovery_active &&
ros::ok())
60 state_recovery_input = execution.
getState();
61 switch (state_recovery_input)
67 ROS_WARN_STREAM(
"Recovering \"" << goal.behavior <<
"\" exceeded the patience time and has been stopped!");
68 recovery_active =
false;
69 result.outcome = mbf_msgs::RecoveryResult::CANCELED;
70 result.message =
"Recovery \"" + goal.behavior +
"\" exceeded the patience time";
82 ROS_INFO_STREAM(
"Recovery behavior \"" << goal.behavior <<
"\" patience exceeded! Cancel recovering...");
85 ROS_WARN_STREAM(
"Cancel recovering \"" << goal.behavior <<
"\" failed or not supported; interrupt it!");
96 recovery_active =
false;
97 result.outcome = mbf_msgs::RecoveryResult::CANCELED;
98 result.message =
"Recovering \"" + goal.behavior +
"\" preempted!";
104 recovery_active =
false;
107 if (result.message.empty())
109 if (result.outcome < 10)
110 result.message =
"Recovery \"" + goal.behavior +
"\" done";
112 result.message =
"Recovery \"" + goal.behavior +
"\" FAILED";
121 recovery_active =
false;
122 result.outcome = mbf_msgs::RecoveryResult::INTERNAL_ERROR;
123 result.message =
"Internal error: Unknown error thrown by the plugin!";
124 goal_handle.
setAborted(result, result.message);
128 result.outcome = mbf_msgs::RecoveryResult::INTERNAL_ERROR;
129 std::stringstream ss;
130 ss <<
"Internal error: Unknown state in a move base flex recovery execution with the number: " 131 <<
static_cast<int>(state_recovery_input);
132 result.message = ss.str();
134 goal_handle.
setAborted(result, result.message);
135 recovery_active =
false;
147 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)
void run(GoalHandle &goal_handle, AbstractRecoveryExecution &execution)
The recovery behavior execution is done.
boost::shared_ptr< const Goal > getGoal() const
AbstractRecoveryExecution::RecoveryState getState()
Returns the current state, thread-safe communication.
std::string getMessage()
Gets the current plugin execution message.
void setCanceled(const Result &result=Result(), const std::string &text=std::string(""))
The recovery execution has been stopped.
void waitForStateUpdate(boost::chrono::microseconds const &duration)
void setSucceeded(const Result &result=Result(), const std::string &text=std::string(""))
RecoveryState
internal state.
const std::string & name_
#define ROS_FATAL_STREAM_NAMED(name, args)
An internal error occurred.
#define ROS_WARN_STREAM(args)
virtual bool cancel()
Cancel the planner execution. This calls the cancel method of the planner plugin. This could be usefu...
void setAborted(const Result &result=Result(), const std::string &text=std::string(""))
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.
RecoveryAction(const std::string &name, const RobotInformation &robot_info)
uint32_t getOutcome()
Gets the current plugin execution outcome.
#define ROS_DEBUG_STREAM_THROTTLE_NAMED(period, name, args)