Main MRPT website > C++ reference
MRPT logo
CObservationRange.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 CObservationRange_H
29 #define CObservationRange_H
30 
32 #include <mrpt/slam/CObservation.h>
33 #include <mrpt/poses/CPose3D.h>
34 #include <mrpt/poses/CPose2D.h>
35 
36 namespace mrpt
37 {
38 namespace slam
39 {
41 
42  /** Declares a class derived from "CObservation" that
43  encapsules a single range measurement, and associated parameters. This can be used
44  * for example to store measurements from infrared proximity sensors (IR) or ultrasonic sensors (sonars).
45  *
46  * \sa CObservation
47  * \ingroup mrpt_obs_grp
48  */
50  {
51  // This must be added to any CSerializable derived class:
53 
54  public:
55  /** Default constructor.
56  */
58 
59  /** The data members
60  */
61  float minSensorDistance;
62  float maxSensorDistance;
63  float sensorConeApperture; //!< Cone aperture of each ultrasonic beam, in radians.
64 
66  {
67  TMeasurement() : sensorID(0), sensorPose(), sensedDistance(0)
68  {}
69 
70  /** Some kind of sensor ID which identifies it on the bus (if applicable, 0 otherwise)
71  */
72  uint16_t sensorID;
73 
74  /** The 6D position of the sensor on the robot.
75  */
77 
78  /** The measured range, in meters (or a value of 0 if there was no detected echo).
79  */
81  };
82 
83  typedef std::deque<TMeasurement> TMeasurementList;
86 
87  TMeasurementList sensedData; //!< All the measurements
88 
89 
90  iterator begin() { return sensedData.begin(); }
91  iterator end() { return sensedData.end(); }
92  const_iterator begin() const { return sensedData.begin(); }
93  const_iterator end() const { return sensedData.end(); }
94 
95  /** A general method to retrieve the sensor pose on the robot.
96  * Note that most sensors will return a full (6D) CPose3D, but see the derived classes for more details or special cases.
97  * \sa setSensorPose
98  */
99  void getSensorPose( CPose3D &out_sensorPose ) const;
100 
101 
102  /** A general method to change the sensor pose on the robot.
103  * Note that most sensors will use the full (6D) CPose3D, but see the derived classes for more details or special cases.
104  * \sa getSensorPose
105  */
106  void setSensorPose( const CPose3D &newSensorPose );
107 
108 
109  }; // End of class def.
110 
111 
112  } // End of namespace
113 } // End of namespace
114 
115 #endif



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