Main MRPT website > C++ reference
MRPT logo
CObservation.h
Go to the documentation of this file.
1 /* +---------------------------------------------------------------------------+
2  | Mobile Robot Programming Toolkit (MRPT) |
3  | http://www.mrpt.org/ |
4  | |
5  | Copyright (c) 2005-2014, Individual contributors, see AUTHORS file |
6  | See: http://www.mrpt.org/Authors - All rights reserved. |
7  | Released under BSD License. See details in http://www.mrpt.org/License |
8  +---------------------------------------------------------------------------+ */
9 #ifndef COBSERVATION_H
10 #define COBSERVATION_H
11 
12 
13 #include <mrpt/obs/link_pragmas.h>
14 
16 //#include <mrpt/utils/CStream.h>
17 //#include <mrpt/system/os.h>
18 #include <mrpt/system/datetime.h>
19 #include <mrpt/math/math_frwds.h>
20 
21 namespace mrpt
22 {
23  /** This namespace contains algorithms for SLAM, localization, map building, representation of robot's actions and observations, and representation of many kinds of metric maps.
24  */
25  namespace slam
26  {
27  using namespace poses;
28 
29  /** Used for CObservationBearingRange::TMeasurement::beaconID
30  * \ingroup mrpt_obs_grp
31  */
32  #define INVALID_LANDMARK_ID (-1)
33 
34  /** Used for CObservationBeaconRange
35  * \ingroup mrpt_obs_grp
36  */
37  #define INVALID_BEACON_ID (-1)
38 
40 
41  /** Declares a class that represents any robot's observation.
42  * This is a base class for many types of sensor observations.
43  * Users can add new observation types creating a new class deriving from this one.
44  *
45  * <b>IMPORTANT</b>: Observations don't include any information about the robot pose,
46  * just raw sensory data and, where aplicable, information about the sensor position and
47  * orientation in the local frame of the robot.
48  *
49  * \sa CSensoryFrame, CMetricMap
50  * \ingroup mrpt_obs_grp
51  */
52  class OBS_IMPEXP CObservation : public mrpt::utils::CSerializable
53  {
54  // This must be added to any CSerializable derived class:
56 
57  protected:
58  void swap(CObservation &o); //!< Swap with another observation, ONLY the data defined here in the base class CObservation. It's protected since it'll be only called from child classes that should know what else to swap appart from these common data.
59 
60  public:
61 
62  /** @name Data common to any observation
63  @{ */
64 
65  /** The associated time-stamp.
66  */
67  mrpt::system::TTimeStamp timestamp;
68 
69  /** An arbitrary label that can be used to identify the sensor.
70  */
71  std::string sensorLabel;
72 
73  /** @} */
74 
75  /** Constructor: It sets the initial timestamp to current time
76  */
77  CObservation();
78 
79 
80  /** This method is equivalent to:
81  * \code
82  * map->insertObservation(this, robotPose)
83  * \endcode
84  * \param theMap The map where this observation is to be inserted: the map will be updated.
85  * \param robotPose The pose of the robot base for this observation, relative to the target metric map. Set to NULL (default) to use (0,0,0deg)
86  *
87  * \return Returns true if the map has been updated, or false if this observations
88  * has nothing to do with a metric map (for example, a sound observation).
89  *
90  * \sa CMetricMap, CMetricMap::insertObservation
91  */
92  template <class METRICMAP>
93  inline bool insertObservationInto( METRICMAP *theMap, const CPose3D *robotPose = NULL ) const
94  {
95  return theMap->insertObservation(this,robotPose);
96  }
97 
98  /** A general method to retrieve the sensor pose on the robot.
99  * Note that most sensors will return a full (6D) CPose3D, but see the derived classes for more details or special cases.
100  * \sa setSensorPose
101  */
102  virtual void getSensorPose( CPose3D &out_sensorPose ) const = 0;
103 
104  /** A general method to retrieve the sensor pose on the robot.
105  * Note that most sensors will return a full (6D) CPose3D, but see the derived classes for more details or special cases.
106  * \sa setSensorPose
107  */
108  void getSensorPose( mrpt::math::TPose3D &out_sensorPose ) const;
109 
110  /** A general method to change the sensor pose on the robot.
111  * Note that most sensors will use the full (6D) CPose3D, but see the derived classes for more details or special cases.
112  * \sa getSensorPose
113  */
114  virtual void setSensorPose( const CPose3D &newSensorPose ) = 0;
115 
116  /** A general method to change the sensor pose on the robot.
117  * Note that most sensors will use the full (6D) CPose3D, but see the derived classes for more details or special cases.
118  * \sa getSensorPose
119  */
120  void setSensorPose( const mrpt::math::TPose3D &newSensorPose );
121 
122  /** @name Delayed-load manual control methods.
123  @{ */
124 
125  /** Makes sure all images and other fields which may be externally stored are loaded in memory.
126  * Note that for all CImages, calling load() is not required since the images will be automatically loaded upon first access, so load() shouldn't be needed to be called in normal cases by the user.
127  * If all the data were alredy loaded or this object has no externally stored data fields, calling this method has no effects.
128  * \sa unload
129  */
130  virtual void load() const { /* Default implementation: do nothing */ }
131  /** Unload all images, for the case they being delayed-load images stored in external files (othewise, has no effect).
132  * \sa load
133  */
134  virtual void unload() { /* Default implementation: do nothing */ }
135 
136  /** @} */
137 
138  }; // End of class def.
139 
140 
141  } // End of namespace
142 } // End of namespace
143 
144 #endif
uint64_t TTimeStamp
A system independent time type, it holds the the number of 100-nanosecond intervals since January 1...
Definition: datetime.h:30
The virtual base class which provides a unified interface for all persistent objects in MRPT...
Definition: CSerializable.h:35
virtual void unload()
Unload all images, for the case they being delayed-load images stored in external files (othewise...
Definition: CObservation.h:134
#define DEFINE_VIRTUAL_SERIALIZABLE(class_name)
This declaration must be inserted in virtual CSerializable classes definition:
#define DEFINE_SERIALIZABLE_PRE_CUSTOM_BASE_LINKAGE(class_name, base_name, _LINKAGE_)
This declaration must be inserted in all CSerializable classes definition, before the class declarati...
Declares a class that represents any robot's observation.
Definition: CObservation.h:52
A class used to store a 3D pose (a 3D translation + a rotation in 3D).
Definition: CPose3D.h:69
Lightweight 3D pose (three spatial coordinates, plus three angular coordinates).
virtual void load() const
Makes sure all images and other fields which may be externally stored are loaded in memory...
Definition: CObservation.h:130



Page generated by Doxygen 1.8.6 for MRPT 1.2.0 SVN: at dom ago 20 02:20:21 CEST 2017 Hosted on:
SourceForge.net Logo