00001 /* +---------------------------------------------------------------------------+ 00002 | The Mobile Robot Programming Toolkit (MRPT) C++ library | 00003 | | 00004 | http://mrpt.sourceforge.net/ | 00005 | | 00006 | Copyright (C) 2005-2009 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 CSensFrameProbSequence_H 00029 #define CSensFrameProbSequence_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( CSensFrameProbSequence ) 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 * \sa CSensoryFrame, CPosePDF 00049 */ 00050 class MRPTDLLIMPEXP CSensFrameProbSequence : public mrpt::utils::CSerializable 00051 { 00052 // This must be added to any CSerializable derived class: 00053 DEFINE_SERIALIZABLE( CSensFrameProbSequence ) 00054 00055 public: 00056 /** Constructor 00057 */ 00058 CSensFrameProbSequence(); 00059 00060 /** Copy constructor 00061 */ 00062 CSensFrameProbSequence( const CSensFrameProbSequence &o ); 00063 00064 /** Copy constructor 00065 */ 00066 CSensFrameProbSequence & operator = ( const CSensFrameProbSequence& o); 00067 00068 /** Destructor: 00069 */ 00070 virtual ~CSensFrameProbSequence(); 00071 00072 /** Returns the pairs count. 00073 */ 00074 size_t size() const; 00075 00076 /** Access to the i'th pair, first one is index '0'. NOTE: This method 00077 * returns pointers to the objects inside the list, nor a copy of them, 00078 * so <b>do neither modify them nor delete them</b>. 00079 * NOTE: You can pass a NULL pointer if you dont need one of the two variables to be returned. 00080 * \exception std::exception On index out of bounds. 00081 */ 00082 void get(size_t index, CPose3DPDFPtr &out_posePDF, CSensoryFramePtr &out_SF ) const ; 00083 00084 /** Changes the i'th pair, first one is index '0'. 00085 * The referenced object is COPIED, so you can freely destroy the object passed as parameter after calling this. 00086 * 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). 00087 * \exception std::exception On index out of bounds. 00088 * \sa insert, get, remove 00089 */ 00090 void set(size_t index, const CPose3DPDFPtr &in_posePDF, const CSensoryFramePtr &in_SF ); 00091 00092 /** Changes the i'th pair, first one is index '0'. 00093 * The referenced object is COPIED, so you can freely destroy the object passed as parameter after calling this. 00094 * 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). 00095 * This version for 2D PDFs just converts the 2D PDF into 3D before calling the 3D version. 00096 * \exception std::exception On index out of bounds. 00097 * \sa insert, get, remove 00098 */ 00099 void set(size_t index, const CPosePDFPtr &in_posePDF, const CSensoryFramePtr &in_SF ); 00100 00101 /** Deletes the i'th pair, first one is index '0'. 00102 * \exception std::exception On index out of bounds. 00103 * \sa insert, get, set 00104 */ 00105 void remove(size_t index); 00106 00107 /** Add a new pair to the sequence. The objects are copied, so original ones can be free if desired after insertion. */ 00108 void insert( const CPose3DPDF *in_posePDF, const CSensoryFrame &in_SF ); 00109 00110 /** Add a new pair to the sequence, making a copy of the smart pointer (it's not made unique). */ 00111 void insert( const CPose3DPDF *in_posePDF, const CSensoryFramePtr &in_SF ); 00112 00113 /** Add a new pair to the sequence, making a copy of the smart pointer (it's not made unique). */ 00114 void insert( const CPose3DPDFPtr &in_posePDF, const CSensoryFramePtr &in_SF ); 00115 00116 /** Add a new pair to the sequence. The objects are copied, so original ones can be free if desired 00117 * after insertion. 00118 * This version for 2D PDFs just converts the 2D PDF into 3D before calling the 3D version. 00119 */ 00120 void insert( const CPosePDFPtr &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 CPosePDF *in_posePDF, const CSensoryFrame &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 CSensoryFramePtr &in_SF ); 00133 00134 /** Remove all stored pairs. 00135 * \sa remove 00136 */ 00137 void clear(); 00138 00139 /** Change the coordinate origin of all stored poses, for consistency with future new poses to enter in the system. */ 00140 void changeCoordinatesOrigin( const CPose3D &newOrigin ); 00141 00142 private: 00143 00144 typedef std::pair<CPose3DPDFPtr,CSensoryFramePtr> TPosePDFSensFramePair; 00145 00146 typedef std::deque<TPosePDFSensFramePair> TPosePDFSensFramePairList; 00147 00148 /** The stored data */ 00149 TPosePDFSensFramePairList m_posesObsPairs; 00150 00151 }; // End of class def. 00152 00153 00154 } // End of namespace 00155 } // End of namespace 00156 00157 #endif
Page generated by Doxygen 1.6.1 for MRPT 0.7.1 SVN: at Tue Dec 22 08:29:35 CET 2009 |