30 #ifndef _MIRA_PILOT_PILOT_H_ 31 #define _MIRA_PILOT_PILOT_H_ 33 #include <serialization/adapters/boost/shared_ptr.hpp> 34 #include <serialization/adapters/std/vector> 41 #include <model/IRigidModelProvider.h> 49 #include <model/Marker.h> 51 namespace mira {
namespace pilot {
69 template<
typename Reflector>
72 r.property(
"DriveService", mDriveService,
73 setter(&Pilot::setDriveService,
this),
74 "The name of the service that is used for setting the velocity " 75 "(if empty, a suitable service is chosen automatically)",
82 r.
property(
"DriveService", mDriveService,
83 setter(&Pilot::setDriveService,
this),
84 "The name of the service that is used for setting the velocity " 85 "(if empty, a suitable service is chosen automatically)",
89 MIRA_LOG(
WARNING) <<
"Pilot failed reading property DriveService as ServiceProperty. " 90 "Fallback: trying as string.";
92 r.
property(
"DriveService", service,
"",
"");
93 MIRA_LOG(
WARNING) <<
"Expected ServiceProperty for Pilot's DriveService property, found string '" 94 << service <<
"'. Please update your config!";
101 template<
typename Reflector>
109 r.property(
"CPUUsage", mCPUUsage,
110 "The cpu usage in percent (default: 90%)",
112 r.property(
"Mute", mMute,
113 "If enabled, then the robot does not send drive commands",
false);
115 r.property(
"UseRecovery", mUseRecovery,
116 "Are recovery strategies enabled",
false);
118 r.roproperty(
"Reached Tasks",
120 "True, if all tasks have been reached");
122 r.property(
"Planner", mPlanner,
123 "The motion planner that is used by the navigator");
125 r.property(
"RecoveryStrategies", mRecoveryStrategies,
"The recovery strategies",
126 std::map<std::string, navigation::TaskPtr>());
130 r.method(
"setMute", &
Pilot::setMute,
this,
"(Un-)Mute the pilot.",
131 "mute",
"true/false to mute/unmute",
true);
137 r.method(
"setRecoverTask", &Pilot::setRecoverTask,
this,
138 "Manually trigger recovery. Only valid if UseRecovery=true.",
139 "task",
"The task used for recovery.", task);
146 virtual void setGoal(
const Pose2& goal,
float transT,
float rotT);
157 return mPlanner ? mPlanner->reachedTasks() :
true;
161 return mCurrentOdometry;
165 mEventChannel.
post(event);
191 void taskError(
const std::string& msg,
const std::string& errorEvent=
"UnknownError");
192 void taskInterruption(
const std::string& msg,
193 const std::string& interruptionEvent=
"UnknownInterruption");
199 virtual Authority* getAuthority() {
return this; }
208 boost::shared_ptr<robot::RobotModel> mRobotModel;
209 boost::mutex mModelMutex;
211 boost::shared_ptr<AbstractPlanner> mPlanner;
225 typedef std::map<std::string, navigation::TaskPtr> RecoveryStrategies;
226 RecoveryStrategies mRecoveryStrategies;
virtual void process(const Timer &timer)
const Stamped< robot::Odometry2 > & getCurrentOdometry() const
Definition: Pilot.h:160
bool getUseRecovery() const
Definition: Pilot.h:172
INTERNAL std::enable_if< std::is_floating_point< T >::value, T >::type deg2rad(T value)
void post(const Stamped< T > &value)
void reflectServices(Reflector &r)
Definition: Pilot.h:70
virtual void initialize()
void reflectServices(XMLDeserializer &r)
Definition: Pilot.h:79
void setMute(bool mute)
Definition: Pilot.h:152
#define MIRA_REFLECT_BASE(reflector, BaseClass)
void reflect(Reflector &r)
Definition: Pilot.h:102
boost::shared_ptr< Task > TaskPtr
boost::shared_ptr< robot::RobotModel > getRobotModel()
Setter< T > setter(void(*f)(const T &))
void property(const char *name, T &member, const char *comment, PropertyHint &&hint=PropertyHint(), ReflectCtrlFlags flags=REFLECT_CTRLFLAG_NONE)
Pilot()
Definition: Pilot.h:60
PropertyHint limits(const T &min, const T &max)
virtual void repeatTask()
Definition: Pilot.h:148
virtual void setGoal(const Pose2 &goal, float transT, float rotT)
void fireEvent(const std::string &event)
Definition: Pilot.h:164
virtual void setTask(navigation::TaskPtr task)
bool reachedTasks() const
Definition: Pilot.h:156
boost::shared_ptr< AbstractPlanner > getPlanner()
Definition: Pilot.h:168
boost::shared_ptr< SubTask > SubTaskPtr