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 particle 00008 * 00009 */ 00010 00011 #ifndef __SLAM__PARTICLE__ 00012 #define __SLAM__PARTICLE__ 00013 00014 #include "visualMap.h" 00015 #include "occupancyGridMap.h" 00016 #include "robotBase.h" 00017 #include "ConfigFile.h" 00018 00019 /** 00020 * 00021 * @brief Implements a particle in a rao-blackwellized particle filter for visual slam 00022 * 00023 */ 00024 class particle{ 00025 00026 /////////////////////////////////////////////////////////////////////// 00027 //------------------------- Attributes ------------------------------ 00028 /////////////////////////////////////////////////////////////////////// 00029 00030 private: 00031 int nrobots; 00032 00033 unsigned short width; 00034 unsigned short height; 00035 float realWidth; 00036 float realHeight; 00037 float xorigin; // Relation between discrete and real axis 00038 float yorigin; 00039 float resolution; 00040 00041 double weight; 00042 double sumLogWeight; 00043 00044 pose* rpos; 00045 point* rcell; 00046 00047 visualMap* vMap; 00048 00049 gridMapInterface* oMap; 00050 binMap* precisePoseMap; 00051 binMap* imprecisePoseMap; 00052 00053 //--------------------------------------------------------------------- 00054 /////////////////////////////////////////////////////////////////////// 00055 00056 /////////////////////////////////////////////////////////////////////// 00057 //------------------------- Methods --------------------------------- 00058 /////////////////////////////////////////////////////////////////////// 00059 00060 public: 00061 00062 /// Default Constructor 00063 particle(); 00064 /// Constructor 00065 particle(int nRobots, float w, float h, float res, float x, float y, int gmtype, int vmtype, int nmarks, const ConfigFile& conf); 00066 /// Copy Constructor 00067 particle(const particle&); 00068 /// Default Destructor 00069 virtual ~particle(); 00070 00071 /// initialization 00072 void initialize(int nRobots, float w, float h, float res, float x, float y, int gmtype, int vmtype, int nmarks, const ConfigFile& conf); 00073 00074 particle& operator=(const particle&); 00075 00076 /// returns the number of robots 00077 int getNumRobots(); 00078 00079 /// returns the pose of the robot 00080 const pose& getPos(int robot); 00081 /// sets the pose of a robot 00082 void setPos(const pose& pos, int robot); 00083 /// returns a pointer to the data array of poses 00084 pose* getDataPos(); 00085 00086 /// returns the cell where the robot is located 00087 const point& getCell(int robot); 00088 /// sets the cell where the robot is located 00089 void setCell(const point& point, int robot); 00090 /// returns a pointer to the data array of cells 00091 point* getDataCell(); 00092 00093 /// returns the visual map of landmarks 00094 visualMap& getVMap(); 00095 /// returns the occupancy grid map 00096 gridMapInterface& getOMap(); 00097 /// returns a binary map of past poses with low dispersion 00098 binMap& getPrecisePoseMap(); 00099 /// returns a binary map of past poses with high dispersion 00100 binMap& getImprecisePoseMap(); 00101 00102 /// sets the weight of the particle 00103 void setWeight(double w); 00104 /// returns the weight of the particle 00105 double getWeight(); 00106 00107 /// sets the weight of the particle 00108 void setSumLogWeight(double w); 00109 /// returns the weight of the particle 00110 double getSumLogWeight(); 00111 00112 void releaseVMap(); 00113 00114 }; 00115 00116 inline int particle::getNumRobots() {return nrobots;} 00117 inline const pose& particle::getPos(int robot) {return (rpos[robot]);} 00118 inline pose* particle::getDataPos() {return rpos;} 00119 inline const point& particle::getCell(int robot) {return (rcell[robot]);} 00120 inline point* particle::getDataCell() {return rcell;} 00121 inline void particle::setCell(const point& point, int robot) {rcell[robot].x = point.x;rcell[robot].y = point.y;} 00122 inline visualMap& particle::getVMap() {return *vMap;} 00123 inline gridMapInterface& particle::getOMap() {return *oMap;} 00124 inline binMap& particle::getPrecisePoseMap() {return *precisePoseMap;} 00125 inline binMap& particle::getImprecisePoseMap() {return *imprecisePoseMap;} 00126 inline void particle::setWeight(double w) {weight = w;} 00127 inline double particle::getWeight() {return weight;} 00128 inline void particle::setSumLogWeight(double w) {sumLogWeight = w;} 00129 inline double particle::getSumLogWeight() {return sumLogWeight;} 00130 inline void particle::releaseVMap() {vMap->clear();} 00131 00132 00133 #endif 00134 00135