MRXT: The Multi-Robot eXploration Tool
Multi-Robot autonomous exploration and mapping simulator.
|
00001 /* 00002 * 00003 * Author: Miguel Julia <mjulia@umh.es> 00004 * 00005 * Date: 2008 00006 * 00007 * Class robot 00008 * 00009 */ 00010 #pragma once 00011 #ifndef __ROBOT__ 00012 #define __ROBOT__ 00013 00014 #include "slamInterface.h" 00015 #include "reactive.h" 00016 #include "planner.h" 00017 #include "robotBase.h" 00018 #include "worldModelInterface.h" 00019 #include "stepEvent.h" 00020 #include "ConfigFile.h" 00021 00022 namespace robots{ 00023 const int EXPLORER = 0; 00024 } 00025 00026 00027 /** 00028 * @brief Implements the architecture for a mobile robot 00029 */ 00030 class robot{ 00031 00032 /////////////////////////////////////////////////////////////////////// 00033 //------------------------- Attributes ------------------------------ 00034 /////////////////////////////////////////////////////////////////////// 00035 protected: 00036 int number; // robot number in the team 00037 char* strlog; 00038 slamInterface* mySlam; // this class is not the owner of this pointer 00039 reactive* reac; 00040 planner* plan; 00041 worldModelInterface* scene; // this class is not the owner of this pointer 00042 robotBase* rbase; 00043 const ConfigFile* config; // this class is not the owner of this pointer 00044 00045 //--------------------------------------------------------------------- 00046 /////////////////////////////////////////////////////////////////////// 00047 00048 /////////////////////////////////////////////////////////////////////// 00049 //------------------------- Methods --------------------------------- 00050 /////////////////////////////////////////////////////////////////////// 00051 public: 00052 /// Default Constructor 00053 robot(); 00054 /// Default Destructor 00055 virtual ~robot(); 00056 00057 /// Constructor 00058 /// \param scene reference to virtual world object 00059 /// \param slamProc reference to slam object 00060 robot(int number, slamInterface& slamProc, worldModelInterface& scene, const ConfigFile& config); 00061 /// Initializer 00062 /// \param scene virtual world 00063 /// \param slamProc pointer to slam object 00064 virtual void initialize(int number, slamInterface& slamProc, worldModelInterface& scene, const ConfigFile& config); 00065 00066 /// returns the robot number 00067 int getNumber() const; 00068 00069 /// returns the robot id 00070 int getId() const; 00071 00072 /// sets the reference to the slam object 00073 void setSlam(slamInterface& slamProc); 00074 00075 /// sets the reference to the virtual world object 00076 void setWorldModel(worldModelInterface& scene); 00077 00078 /// sets the log file 00079 void setLogName(const char* str); 00080 /// returns the reference to the planner exploration concluded event manager 00081 stepEventManager& endEvent() const; 00082 00083 /// Initiatites the hybrid exploration of the environment 00084 virtual void start()=0; 00085 00086 /// stops all actions execution 00087 virtual void stop()=0; 00088 00089 void disable(); 00090 //--------------------------------------------------------------------- 00091 /////////////////////////////////////////////////////////////////////// 00092 }; 00093 00094 inline int robot::getNumber() const {return number;} 00095 inline int robot::getId() const {return rbase->getNumber();} 00096 inline void robot::setSlam(slamInterface& slamProc) {mySlam = &slamProc;} 00097 inline void robot::setWorldModel(worldModelInterface& s) {scene = &s;} 00098 inline stepEventManager& robot::endEvent() const {return plan->explorationFinished;} 00099 inline void robot::disable() {mySlam->disableRobotBase(number); scene->disablePlatform(*rbase); } 00100 00101 typedef Loki::Functor<robot*, LOKI_TYPELIST_4(int, slamInterface&, worldModelInterface&, const ConfigFile&)> robotCreator; 00102 typedef Loki::SingletonHolder< Loki::Factory< robot, int, LOKI_TYPELIST_4(int, slamInterface&, worldModelInterface&, const ConfigFile&)> > robotFactory; 00103 00104 00105 #endif 00106