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. More...
#include <abstract_recovery_execution.h>
Public Types | |
typedef boost::shared_ptr < AbstractRecoveryExecution > | Ptr |
enum | RecoveryState { INITIALIZED, STARTED, RECOVERING, WRONG_NAME, RECOVERY_DONE, CANCELED, STOPPED, INTERNAL_ERROR } |
internal state. More... | |
Public Member Functions | |
AbstractRecoveryExecution (const std::string name, const mbf_abstract_core::AbstractRecovery::Ptr recovery_ptr, const TFPtr &tf_listener_ptr, const MoveBaseFlexConfig &config, boost::function< void()> setup_fn, boost::function< void()> cleanup_fn) | |
Constructor. | |
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. | |
AbstractRecoveryExecution::RecoveryState | getState () |
Returns the current state, thread-safe communication. | |
bool | isPatienceExceeded () |
Checks whether the patience was exceeded. | |
void | reconfigure (const MoveBaseFlexConfig &config) |
Reconfigures the current configuration and reloads all parameters. This method is called from a dynamic reconfigure tool. | |
virtual | ~AbstractRecoveryExecution () |
Destructor. | |
Protected Member Functions | |
virtual void | run () |
Main execution method which will be executed by the recovery execution thread_. | |
Protected Attributes | |
mbf_abstract_core::AbstractRecovery::Ptr | behavior_ |
the current loaded recovery behavior | |
const TFPtr | tf_listener_ptr_ |
shared pointer to common TransformListener | |
Private Member Functions | |
void | setState (RecoveryState state) |
Sets the current internal state. This method is thread communication safe. | |
Private Attributes | |
boost::mutex | conf_mtx_ |
dynamic reconfigure and start time mutexes to mutually exclude read/write configuration | |
ros::Duration | patience_ |
recovery behavior allowed time | |
ros::Time | start_time_ |
recovery behavior start time | |
RecoveryState | state_ |
current internal state | |
boost::mutex | state_mtx_ |
mutex to handle safe thread communication for the current state | |
boost::mutex | time_mtx_ |
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.
Definition at line 76 of file abstract_recovery_execution.h.
typedef boost::shared_ptr<AbstractRecoveryExecution > mbf_abstract_nav::AbstractRecoveryExecution::Ptr |
Definition at line 80 of file abstract_recovery_execution.h.
internal state.
Definition at line 115 of file abstract_recovery_execution.h.
mbf_abstract_nav::AbstractRecoveryExecution::AbstractRecoveryExecution | ( | const std::string | name, |
const mbf_abstract_core::AbstractRecovery::Ptr | recovery_ptr, | ||
const TFPtr & | tf_listener_ptr, | ||
const MoveBaseFlexConfig & | config, | ||
boost::function< void()> | setup_fn, | ||
boost::function< void()> | cleanup_fn | ||
) |
Constructor.
condition | Thread sleep condition variable, to wake up connected threads |
tf_listener_ptr | Shared pointer to a common tf listener |
Definition at line 50 of file abstract_recovery_execution.cpp.
Destructor.
Definition at line 64 of file abstract_recovery_execution.cpp.
bool mbf_abstract_nav::AbstractRecoveryExecution::cancel | ( | ) | [virtual] |
Cancel the planner execution. This calls the cancel method of the planner plugin. This could be useful if the computation takes too much time.
Implements mbf_abstract_nav::AbstractExecutionBase.
Definition at line 94 of file abstract_recovery_execution.cpp.
Returns the current state, thread-safe communication.
Definition at line 88 of file abstract_recovery_execution.cpp.
Checks whether the patience was exceeded.
Definition at line 107 of file abstract_recovery_execution.cpp.
void mbf_abstract_nav::AbstractRecoveryExecution::reconfigure | ( | const MoveBaseFlexConfig & | config | ) |
Reconfigures the current configuration and reloads all parameters. This method is called from a dynamic reconfigure tool.
config | Current MoveBaseFlexConfig object. See the MoveBaseFlex.cfg definition. |
Definition at line 69 of file abstract_recovery_execution.cpp.
void mbf_abstract_nav::AbstractRecoveryExecution::run | ( | ) | [protected, virtual] |
Main execution method which will be executed by the recovery execution thread_.
Implements mbf_abstract_nav::AbstractExecutionBase.
Definition at line 115 of file abstract_recovery_execution.cpp.
void mbf_abstract_nav::AbstractRecoveryExecution::setState | ( | RecoveryState | state | ) | [private] |
Sets the current internal state. This method is thread communication safe.
state | The state to set. |
Definition at line 81 of file abstract_recovery_execution.cpp.
mbf_abstract_core::AbstractRecovery::Ptr mbf_abstract_nav::AbstractRecoveryExecution::behavior_ [protected] |
the current loaded recovery behavior
Definition at line 148 of file abstract_recovery_execution.h.
boost::mutex mbf_abstract_nav::AbstractRecoveryExecution::conf_mtx_ [private] |
dynamic reconfigure and start time mutexes to mutually exclude read/write configuration
Definition at line 165 of file abstract_recovery_execution.h.
recovery behavior allowed time
Definition at line 169 of file abstract_recovery_execution.h.
recovery behavior start time
Definition at line 172 of file abstract_recovery_execution.h.
current internal state
Definition at line 175 of file abstract_recovery_execution.h.
boost::mutex mbf_abstract_nav::AbstractRecoveryExecution::state_mtx_ [private] |
mutex to handle safe thread communication for the current state
Definition at line 162 of file abstract_recovery_execution.h.
const TFPtr mbf_abstract_nav::AbstractRecoveryExecution::tf_listener_ptr_ [protected] |
shared pointer to common TransformListener
Definition at line 151 of file abstract_recovery_execution.h.
boost::mutex mbf_abstract_nav::AbstractRecoveryExecution::time_mtx_ [private] |
Definition at line 166 of file abstract_recovery_execution.h.