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 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 namespace mrpt 00039 { 00040 namespace slam 00041 { 00042 using namespace mrpt::poses; 00043 using namespace mrpt::vision; 00044 using namespace mrpt::math; 00045 00046 DEFINE_SERIALIZABLE_PRE( CLandmark ) 00047 00048 /** The class for storing "landmarks" (visual or laser-scan-extracted features,...) 00049 * 00050 * The descriptors for each kind of descriptor are stored in the vector "features", which 00051 * will typically consists of only 1 element, or 2 elements for landmarks obtained from stereo images. 00052 * 00053 * \sa CLandmarksMap 00054 */ 00055 class MRPTDLLIMPEXP CLandmark : public mrpt::utils::CSerializable 00056 { 00057 // This must be added to any CSerializable derived class: 00058 DEFINE_SERIALIZABLE( CLandmark ) 00059 00060 public: 00061 typedef int64_t TLandmarkID; //!< The type for the IDs of landmarks. 00062 00063 std::vector<CFeaturePtr> features; //!< The set of features from which the landmark comes. 00064 00065 TPoint3D pose_mean; //!< The mean of the landmark 3D position. 00066 TPoint3D normal; //!< The "normal" to the landmark, i.e. a unitary 3D vector towards the viewing direction, or a null vector if not applicable 00067 float pose_cov_11,pose_cov_22,pose_cov_33,pose_cov_12,pose_cov_13,pose_cov_23; 00068 00069 /** An ID for the landmark (see details next...) 00070 * This ID was introduced in the version 3 of this class (21/NOV/2006), and its aim is 00071 * to provide a way for easily establishing correspondences between landmarks detected 00072 * in sequential image frames. Thus, the management of this field should be: 00073 * - 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). 00074 * - 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. 00075 * 00076 * Note that this field is never fill out automatically, it must be set by the programmer if used. 00077 */ 00078 TLandmarkID ID; 00079 mrpt::system::TTimeStamp timestampLastSeen; //!< The last time that this landmark was observed. 00080 uint32_t seenTimesCount; //!< The number of times that this landmark has been seen. 00081 00082 /** Returns the pose as an object: 00083 */ 00084 void getPose( CPointPDFGaussian &p ) const; 00085 00086 void getPose( CPoint3D &p, CMatrixDouble &COV ) const { 00087 CPointPDFGaussian pdf; 00088 getPose(pdf); 00089 p = pdf.mean; 00090 COV = pdf.cov; 00091 } 00092 00093 /** Sets the pose from an object: 00094 */ 00095 void setPose( const CPointPDFGaussian &p ); 00096 00097 /** Gets the type of the first feature in its feature vector. The vector must not be empty. 00098 */ 00099 TFeatureType getType() const 00100 { ASSERT_( !features.empty() ); ASSERT_(features[0].present()) return features[0]->type; } 00101 00102 /** 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. 00103 */ 00104 void createOneFeature() 00105 { features.assign(1, CFeaturePtr( new CFeature() ) ); } 00106 00107 /** Default constructor 00108 */ 00109 CLandmark(); 00110 00111 /** Virtual destructor 00112 */ 00113 virtual ~CLandmark(); 00114 00115 protected: 00116 /** Auxiliary variable 00117 */ 00118 static TLandmarkID m_counterIDs; 00119 00120 }; // End of class definition 00121 00122 } // End of namespace 00123 } // End of namespace 00124 00125 #endif
Page generated by Doxygen 1.5.9 for MRPT 0.7.1 SVN: at Mon Aug 17 22:27:43 EDT 2009 |