Main MRPT website > C++ reference
MRPT logo
CLandmark.h
Go to the documentation of this file.
1 /* +---------------------------------------------------------------------------+
2  | The Mobile Robot Programming Toolkit (MRPT) C++ library |
3  | |
4  | http://www.mrpt.org/ |
5  | |
6  | Copyright (C) 2005-2012 University of Malaga |
7  | |
8  | This software was written by the Machine Perception and Intelligent |
9  | Robotics Lab, University of Malaga (Spain). |
10  | Contact: Jose-Luis Blanco <jlblanco@ctima.uma.es> |
11  | |
12  | This file is part of the MRPT project. |
13  | |
14  | MRPT is free software: you can redistribute it and/or modify |
15  | it under the terms of the GNU General Public License as published by |
16  | the Free Software Foundation, either version 3 of the License, or |
17  | (at your option) any later version. |
18  | |
19  | MRPT is distributed in the hope that it will be useful, |
20  | but WITHOUT ANY WARRANTY; without even the implied warranty of |
21  | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
22  | GNU General Public License for more details. |
23  | |
24  | You should have received a copy of the GNU General Public License |
25  | along with MRPT. If not, see <http://www.gnu.org/licenses/>. |
26  | |
27  +---------------------------------------------------------------------------+ */
28 #ifndef CLandmark_H
29 #define CLandmark_H
30 
32 #include <mrpt/math/CMatrix.h>
33 #include <mrpt/system/os.h>
35 #include <mrpt/poses/CPoint3D.h>
36 #include <mrpt/vision/CFeature.h>
38 
39 
40 namespace mrpt
41 {
42  /** \ingroup mrpt_vision_grp */
43  namespace slam
44  {
45  using namespace mrpt::poses;
46  using namespace mrpt::vision;
47  using namespace mrpt::math;
48 
50 
51  /** The class for storing "landmarks" (visual or laser-scan-extracted features,...)
52  *
53  * The descriptors for each kind of descriptor are stored in the vector "features", which
54  * will typically consists of only 1 element, or 2 elements for landmarks obtained from stereo images.
55  *
56  * \sa CLandmarksMap
57  * \ingroup mrpt_vision_grp
58  */
59  class VISION_IMPEXP CLandmark : public mrpt::utils::CSerializable
60  {
61  // This must be added to any CSerializable derived class:
63 
64  public:
65  typedef int64_t TLandmarkID; //!< The type for the IDs of landmarks.
66 
67  std::vector<CFeaturePtr> features; //!< The set of features from which the landmark comes.
68 
69  TPoint3D pose_mean; //!< The mean of the landmark 3D position.
70  TPoint3D normal; //!< The "normal" to the landmark, i.e. a unitary 3D vector towards the viewing direction, or a null vector if not applicable
71  float pose_cov_11,pose_cov_22,pose_cov_33,pose_cov_12,pose_cov_13,pose_cov_23;
72 
73  /** An ID for the landmark (see details next...)
74  * This ID was introduced in the version 3 of this class (21/NOV/2006), and its aim is
75  * to provide a way for easily establishing correspondences between landmarks detected
76  * in sequential image frames. Thus, the management of this field should be:
77  * - 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).
78  * - 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.
79  *
80  * Note that this field is never fill out automatically, it must be set by the programmer if used.
81  */
82  TLandmarkID ID;
83  mrpt::system::TTimeStamp timestampLastSeen; //!< The last time that this landmark was observed.
84  uint32_t seenTimesCount; //!< The number of times that this landmark has been seen.
85 
86  /** Returns the pose as an object:
87  */
88  void getPose( CPointPDFGaussian &p ) const;
89 
90  void getPose( CPoint3D &p, CMatrixDouble &COV ) const {
92  getPose(pdf);
93  p = pdf.mean;
94  COV = CMatrixDouble(pdf.cov);
95  }
96 
97  /** Sets the pose from an object:
98  */
99  void setPose( const CPointPDFGaussian &p );
100 
101  /** Gets the type of the first feature in its feature vector. The vector must not be empty.
102  */
103  TFeatureType getType() const
104  { ASSERT_( !features.empty() ); ASSERT_(features[0].present()) return features[0]->type; }
105 
106  /** 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.
107  */
108  void createOneFeature()
109  { features.assign(1, CFeaturePtr( new CFeature() ) ); }
110 
111  /** Default constructor
112  */
113  CLandmark();
114 
115  /** Virtual destructor
116  */
117  virtual ~CLandmark();
118 
119  protected:
120  /** Auxiliary variable
121  */
123 
124  }; // End of class definition
125 
126  } // End of namespace
127 } // End of namespace
128 
129 #endif



Page generated by Doxygen 1.8.3 for MRPT 0.9.6 SVN: at Fri Feb 15 22:05:02 EST 2013