Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041 #ifndef MBF_ABSTRACT_NAV__ABSTRACT_RECOVERY_EXECUTION_H_
00042 #define MBF_ABSTRACT_NAV__ABSTRACT_RECOVERY_EXECUTION_H_
00043
00044 #include <map>
00045 #include <string>
00046 #include <stdint.h>
00047 #include <vector>
00048
00049 #include <tf/transform_listener.h>
00050
00051 #include <mbf_abstract_core/abstract_recovery.h>
00052 #include <mbf_utility/types.h>
00053
00054 #include <mbf_utility/navigation_utility.h>
00055
00056 #include "mbf_abstract_nav/MoveBaseFlexConfig.h"
00057 #include "mbf_abstract_nav/abstract_execution_base.h"
00058
00059
00060 namespace mbf_abstract_nav
00061 {
00076 class AbstractRecoveryExecution : public AbstractExecutionBase
00077 {
00078 public:
00079
00080 typedef boost::shared_ptr<AbstractRecoveryExecution > Ptr;
00081
00087 AbstractRecoveryExecution(const std::string name,
00088 const mbf_abstract_core::AbstractRecovery::Ptr recovery_ptr,
00089 const TFPtr &tf_listener_ptr,
00090 const MoveBaseFlexConfig &config,
00091 boost::function<void()> setup_fn,
00092 boost::function<void()> cleanup_fn);
00093
00097 virtual ~AbstractRecoveryExecution();
00098
00103 bool isPatienceExceeded();
00104
00110 virtual bool cancel();
00111
00115 enum RecoveryState
00116 {
00117 INITIALIZED,
00118 STARTED,
00119 RECOVERING,
00120 WRONG_NAME,
00121 RECOVERY_DONE,
00122 CANCELED,
00123 STOPPED,
00124 INTERNAL_ERROR
00125 };
00126
00131 AbstractRecoveryExecution::RecoveryState getState();
00132
00138 void reconfigure(const MoveBaseFlexConfig &config);
00139
00140 protected:
00141
00145 virtual void run();
00146
00148 mbf_abstract_core::AbstractRecovery::Ptr behavior_;
00149
00151 const TFPtr tf_listener_ptr_;
00152
00153 private:
00154
00159 void setState(RecoveryState state);
00160
00162 boost::mutex state_mtx_;
00163
00165 boost::mutex conf_mtx_;
00166 boost::mutex time_mtx_;
00167
00169 ros::Duration patience_;
00170
00172 ros::Time start_time_;
00173
00175 RecoveryState state_;
00176 };
00177
00178 }
00179
00180 #endif