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 visualMap 00008 * 00009 * 00010 */ 00011 #pragma once 00012 #ifndef __VISUAL_MAP__ARRAY__IMPLEMENTATION__ 00013 #define __VISUAL_MAP__ARRAY__IMPLEMENTATION__ 00014 00015 #include <string.h> 00016 #include <opencv2/opencv.hpp> 00017 #include "landmarksData.h" 00018 #include "matFuns.h" 00019 #include "ConfigFile.h" 00020 #include "visualMap.h" 00021 00022 /** 00023 * @brief Implements a visual landmark 3d map using a simple array of features 00024 * 00025 */ 00026 class vMapArray: public visualMap{ 00027 00028 /////////////////////////////////////////////////////////////////////// 00029 //------------------------- Attributes ------------------------------ 00030 /////////////////////////////////////////////////////////////////////// 00031 private: 00032 00033 unsigned short nMarksReserved; 00034 int lastRetId; 00035 landmark* landmarks; 00036 00037 //--------------------------------------------------------------------- 00038 /////////////////////////////////////////////////////////////////////// 00039 00040 /////////////////////////////////////////////////////////////////////// 00041 //------------------------- Methods --------------------------------- 00042 /////////////////////////////////////////////////////////////////////// 00043 00044 public: 00045 00046 /// default constructor 00047 vMapArray(); 00048 /// constructor 00049 vMapArray(int n, const ConfigFile& config); 00050 /// copy constructor 00051 vMapArray(const vMapArray&); 00052 /// destructor 00053 virtual ~vMapArray(); 00054 00055 /// initializer 00056 void initialize(int n, const ConfigFile& config); 00057 /// assignment operator 00058 vMapArray& operator=(const visualMap&); 00059 /// clone method 00060 vMapArray* clone() const; 00061 00062 /// Data functions 00063 void addLandmark(const landmark& mark); 00064 00065 /// data association, return a NEW copy of the matched mark in the map, the returned mark must be DELETE 00066 landmark* dataAssociation(const matrix& ZT, const matrix& Rt, const pos3d& globalpos, const pose& robotPos, const matrix& H, const matrix& Htrans, const float* desc) ; 00067 /// return return a NEW copy of the landmark with descriptor desc, the returned mark must be DELETE 00068 landmark* getLandmarkByDesc(const float* desc) ; 00069 /// return return a NEW copy of the landmark with id number, the returned mark must be DELETE 00070 landmark* getLandmarkById(int number); 00071 /// changes a landmark 00072 void changeLandmark(int id, const landmark& mark); 00073 /// changes a landmark in the kdtree 00074 void changeLastReturnedLandmark(const landmark& mark); 00075 00076 /// clear the map 00077 void clear(); 00078 /// saves the map 00079 void saveMap(const char* str); 00080 /// draw the features in an opencv image 00081 void drawMarks (IplImage& im, float xorigin, float yorigin, float resolution) ; 00082 00083 /// return the last returned id 00084 int returnLastReturnedId() const; 00085 00086 00087 //--------------------------------------------------------------------- 00088 /////////////////////////////////////////////////////////////////////// 00089 }; 00090 00091 inline int vMapArray::returnLastReturnedId() const {return lastRetId;} 00092 inline vMapArray* vMapArray::clone() const {return new vMapArray(*this);}; 00093 00094 #endif