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