00001 /* +---------------------------------------------------------------------------+ 00002 | The Mobile Robot Programming Toolkit (MRPT) C++ library | 00003 | | 00004 | http://mrpt.sourceforge.net/ | 00005 | | 00006 | Copyright (C) 2005-2010 University of Malaga | 00007 | | 00008 | This software was written by the Machine Perception and Intelligent | 00009 | Robotics Lab, University of Malaga (Spain). | 00010 | Contact: Jose-Luis Blanco <jlblanco@ctima.uma.es> | 00011 | | 00012 | This file is part of the MRPT project. | 00013 | | 00014 | MRPT is free software: you can redistribute it and/or modify | 00015 | it under the terms of the GNU General Public License as published by | 00016 | the Free Software Foundation, either version 3 of the License, or | 00017 | (at your option) any later version. | 00018 | | 00019 | MRPT is distributed in the hope that it will be useful, | 00020 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 00021 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 00022 | GNU General Public License for more details. | 00023 | | 00024 | You should have received a copy of the GNU General Public License | 00025 | along with MRPT. If not, see <http://www.gnu.org/licenses/>. | 00026 | | 00027 +---------------------------------------------------------------------------+ */ 00028 #ifndef CSimpleMap_H 00029 #define CSimpleMap_H 00030 00031 #include <mrpt/utils/CSerializable.h> 00032 #include <mrpt/slam/CSensoryFrame.h> 00033 #include <mrpt/poses/CPosePDF.h> 00034 #include <mrpt/poses/CPose3DPDF.h> 00035 00036 namespace mrpt 00037 { 00038 namespace slam 00039 { 00040 // This must be added to any CSerializable derived class: 00041 DEFINE_SERIALIZABLE_PRE_CUSTOM_BASE_LINKAGE( CSimpleMap, mrpt::utils::CSerializable, OBS_IMPEXP ) 00042 00043 /** This class stores a sequence of <Probabilistic Pose,SensoryFrame> pairs, thus a "metric map" can be totally determined with this information. 00044 * The pose of the sensory frame is not deterministic, but described by some PDF. Full 6D poses are used. 00045 * 00046 * \note Objects of this class are serialized into (possibly GZ-compressed) files with the extension ".simplemap". 00047 * 00048 * \note Before MRPT 0.9.0 the name of this class was "CSensFrameProbSequence", that's why there is a typedef with that name to allow backward compatibility. 00049 * \sa CSensoryFrame, CPosePDF 00050 */ 00051 class OBS_IMPEXP CSimpleMap : public mrpt::utils::CSerializable 00052 { 00053 // This must be added to any CSerializable derived class: 00054 DEFINE_SERIALIZABLE( CSimpleMap ) 00055 // ------------------------------------------------------------------------------- 00056 // HACK: For compatibility with old data (See CSimpleMap.cpp) 00057 // ------------------------------------------------------------------------------- 00058 static mrpt::utils::CLASSINIT _init_CSensFrameProbSequence; 00059 static mrpt::utils::TRuntimeClassId classCSensFrameProbSequence; 00060 00061 public: 00062 /** Constructor 00063 */ 00064 CSimpleMap(); 00065 00066 /** Copy constructor 00067 */ 00068 CSimpleMap( const CSimpleMap &o ); 00069 00070 /** Copy constructor 00071 */ 00072 CSimpleMap & operator = ( const CSimpleMap& o); 00073 00074 /** Destructor: 00075 */ 00076 virtual ~CSimpleMap(); 00077 00078 /** Returns the pairs count. 00079 */ 00080 size_t size() const; 00081 00082 /** Access to the i'th pair, first one is index '0'. NOTE: This method 00083 * returns pointers to the objects inside the list, nor a copy of them, 00084 * so <b>do neither modify them nor delete them</b>. 00085 * NOTE: You can pass a NULL pointer if you dont need one of the two variables to be returned. 00086 * \exception std::exception On index out of bounds. 00087 */ 00088 void get(size_t index, CPose3DPDFPtr &out_posePDF, CSensoryFramePtr &out_SF ) const ; 00089 00090 /** Changes the i'th pair, first one is index '0'. 00091 * The referenced object is COPIED, so you can freely destroy the object passed as parameter after calling this. 00092 * If one of the pointers is NULL, the corresponding contents of the current i'th pair is not modified (i.e. if you want just to modify one of the values). 00093 * \exception std::exception On index out of bounds. 00094 * \sa insert, get, remove 00095 */ 00096 void set(size_t index, const CPose3DPDFPtr &in_posePDF, const CSensoryFramePtr &in_SF ); 00097 00098 /** Changes the i'th pair, first one is index '0'. 00099 * The referenced object is COPIED, so you can freely destroy the object passed as parameter after calling this. 00100 * If one of the pointers is NULL, the corresponding contents of the current i'th pair is not modified (i.e. if you want just to modify one of the values). 00101 * This version for 2D PDFs just converts the 2D PDF into 3D before calling the 3D version. 00102 * \exception std::exception On index out of bounds. 00103 * \sa insert, get, remove 00104 */ 00105 void set(size_t index, const CPosePDFPtr &in_posePDF, const CSensoryFramePtr &in_SF ); 00106 00107 /** Deletes the i'th pair, first one is index '0'. 00108 * \exception std::exception On index out of bounds. 00109 * \sa insert, get, set 00110 */ 00111 void remove(size_t index); 00112 00113 /** Add a new pair to the sequence. The objects are copied, so original ones can be free if desired after insertion. */ 00114 void insert( const CPose3DPDF *in_posePDF, const CSensoryFrame &in_SF ); 00115 00116 /** Add a new pair to the sequence, making a copy of the smart pointer (it's not made unique). */ 00117 void insert( const CPose3DPDF *in_posePDF, const CSensoryFramePtr &in_SF ); 00118 00119 /** Add a new pair to the sequence, making a copy of the smart pointer (it's not made unique). */ 00120 void insert( const CPose3DPDFPtr &in_posePDF, const CSensoryFramePtr &in_SF ); 00121 00122 /** Add a new pair to the sequence. The objects are copied, so original ones can be free if desired 00123 * after insertion. 00124 * This version for 2D PDFs just converts the 2D PDF into 3D before calling the 3D version. 00125 */ 00126 void insert( const CPosePDFPtr &in_posePDF, const CSensoryFramePtr &in_SF ); 00127 00128 /** Add a new pair to the sequence. The objects are copied, so original ones can be free if desired 00129 * after insertion. 00130 * This version for 2D PDFs just converts the 2D PDF into 3D before calling the 3D version. 00131 */ 00132 void insert( const CPosePDF *in_posePDF, const CSensoryFrame &in_SF ); 00133 00134 /** Add a new pair to the sequence. The objects are copied, so original ones can be free if desired 00135 * after insertion. 00136 * This version for 2D PDFs just converts the 2D PDF into 3D before calling the 3D version. 00137 */ 00138 void insert( const CPosePDF *in_posePDF, const CSensoryFramePtr &in_SF ); 00139 00140 /** Remove all stored pairs. 00141 * \sa remove 00142 */ 00143 void clear(); 00144 00145 /** Change the coordinate origin of all stored poses, for consistency with future new poses to enter in the system. */ 00146 void changeCoordinatesOrigin( const CPose3D &newOrigin ); 00147 00148 private: 00149 00150 typedef std::pair<CPose3DPDFPtr,CSensoryFramePtr> TPosePDFSensFramePair; 00151 00152 typedef std::deque<TPosePDFSensFramePair> TPosePDFSensFramePairList; 00153 00154 /** The stored data */ 00155 TPosePDFSensFramePairList m_posesObsPairs; 00156 00157 }; // End of class def. 00158 00159 // For compatibility with code < 0.9.0 00160 typedef CSimpleMap CSensFrameProbSequence; 00161 typedef CSimpleMapPtr CSensFrameProbSequencePtr; 00162 00163 00164 } // End of namespace 00165 } // End of namespace 00166 00167 #endif
| Page generated by Doxygen 1.6.1 for MRPT 0.9.0 SVN: at Mon Jun 7 06:47:58 UTC 2010 |
