00001 /* +---------------------------------------------------------------------------+ 00002 | The Mobile Robot Programming Toolkit (MRPT) C++ library | 00003 | | 00004 | http://mrpt.sourceforge.net/ | 00005 | | 00006 | Copyright (C) 2005-2011 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 CLandmark_H 00029 #define CLandmark_H 00030 00031 #include <mrpt/utils/CSerializable.h> 00032 #include <mrpt/math/CMatrix.h> 00033 #include <mrpt/system/os.h> 00034 #include <mrpt/poses/CPointPDFGaussian.h> 00035 #include <mrpt/poses/CPoint3D.h> 00036 #include <mrpt/vision/CFeature.h> 00037 #include <mrpt/math/lightweight_geom_data.h> 00038 00039 00040 namespace mrpt 00041 { 00042 namespace slam 00043 { 00044 using namespace mrpt::poses; 00045 using namespace mrpt::vision; 00046 using namespace mrpt::math; 00047 00048 DEFINE_SERIALIZABLE_PRE_CUSTOM_BASE_LINKAGE( CLandmark, mrpt::utils::CSerializable, VISION_IMPEXP ) 00049 00050 /** The class for storing "landmarks" (visual or laser-scan-extracted features,...) 00051 * 00052 * The descriptors for each kind of descriptor are stored in the vector "features", which 00053 * will typically consists of only 1 element, or 2 elements for landmarks obtained from stereo images. 00054 * 00055 * \sa CLandmarksMap 00056 */ 00057 class VISION_IMPEXP CLandmark : public mrpt::utils::CSerializable 00058 { 00059 // This must be added to any CSerializable derived class: 00060 DEFINE_SERIALIZABLE( CLandmark ) 00061 00062 public: 00063 typedef int64_t TLandmarkID; //!< The type for the IDs of landmarks. 00064 00065 std::vector<CFeaturePtr> features; //!< The set of features from which the landmark comes. 00066 00067 TPoint3D pose_mean; //!< The mean of the landmark 3D position. 00068 TPoint3D normal; //!< The "normal" to the landmark, i.e. a unitary 3D vector towards the viewing direction, or a null vector if not applicable 00069 float pose_cov_11,pose_cov_22,pose_cov_33,pose_cov_12,pose_cov_13,pose_cov_23; 00070 00071 /** An ID for the landmark (see details next...) 00072 * This ID was introduced in the version 3 of this class (21/NOV/2006), and its aim is 00073 * to provide a way for easily establishing correspondences between landmarks detected 00074 * in sequential image frames. Thus, the management of this field should be: 00075 * - In 'servers' (classes/modules/... that detect landmarks from images): A different ID must be assigned to every landmark (e.g. a sequential counter), BUT only in the case of being sure of the correspondence of one landmark with another one in the past (e.g. tracking). 00076 * - In 'clients': This field can be ignored, but if it is used, the advantage is solving the correspondence between landmarks detected in consequentive instants of time: Two landmarks with the same ID <b>correspond</b> to the same physical feature, BUT it should not be expected the inverse to be always true. 00077 * 00078 * Note that this field is never fill out automatically, it must be set by the programmer if used. 00079 */ 00080 TLandmarkID ID; 00081 mrpt::system::TTimeStamp timestampLastSeen; //!< The last time that this landmark was observed. 00082 uint32_t seenTimesCount; //!< The number of times that this landmark has been seen. 00083 00084 /** Returns the pose as an object: 00085 */ 00086 void getPose( CPointPDFGaussian &p ) const; 00087 00088 void getPose( CPoint3D &p, CMatrixDouble &COV ) const { 00089 CPointPDFGaussian pdf; 00090 getPose(pdf); 00091 p = pdf.mean; 00092 COV = CMatrixDouble(pdf.cov); 00093 } 00094 00095 /** Sets the pose from an object: 00096 */ 00097 void setPose( const CPointPDFGaussian &p ); 00098 00099 /** Gets the type of the first feature in its feature vector. The vector must not be empty. 00100 */ 00101 TFeatureType getType() const 00102 { ASSERT_( !features.empty() ); ASSERT_(features[0].present()) return features[0]->type; } 00103 00104 /** Creates one feature in the vector "features", calling the appropriate constructor of the smart pointer, so after calling this method "features[0]" is a valid pointer to a CFeature object. 00105 */ 00106 void createOneFeature() 00107 { features.assign(1, CFeaturePtr( new CFeature() ) ); } 00108 00109 /** Default constructor 00110 */ 00111 CLandmark(); 00112 00113 /** Virtual destructor 00114 */ 00115 virtual ~CLandmark(); 00116 00117 protected: 00118 /** Auxiliary variable 00119 */ 00120 static TLandmarkID m_counterIDs; 00121 00122 }; // End of class definition 00123 00124 } // End of namespace 00125 } // End of namespace 00126 00127 #endif
Page generated by Doxygen 1.7.3 for MRPT 0.9.4 SVN: at Sat Mar 26 06:40:17 UTC 2011 |