Main MRPT website > C++ reference
MRPT logo

CObservationRange.h

Go to the documentation of this file.
00001 /* +---------------------------------------------------------------------------+
00002    |          The Mobile Robot Programming Toolkit (MRPT) C++ library          |
00003    |                                                                           |
00004    |                   http://mrpt.sourceforge.net/                            |
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 CObservationRange_H
00029 #define CObservationRange_H
00030 
00031 #include <mrpt/utils/CSerializable.h>
00032 #include <mrpt/slam/CObservation.h>
00033 #include <mrpt/poses/CPose3D.h>
00034 #include <mrpt/poses/CPose2D.h>
00035 
00036 namespace mrpt
00037 {
00038 namespace slam
00039 {
00040         DEFINE_SERIALIZABLE_PRE_CUSTOM_BASE_LINKAGE( CObservationRange , CObservation,OBS_IMPEXP )
00041 
00042         /** Declares a class derived from "CObservation" that
00043                encapsules a single range measurement, and associated parameters. This can be used
00044          *     for example to store measurements from infrared proximity sensors (IR) or ultrasonic sensors (sonars).
00045          *
00046          * \sa CObservation
00047          */
00048         class OBS_IMPEXP CObservationRange : public CObservation
00049         {
00050                 // This must be added to any CSerializable derived class:
00051                 DEFINE_SERIALIZABLE( CObservationRange )
00052 
00053          public:
00054                 /** Default constructor.
00055                  */
00056                 CObservationRange( );
00057 
00058                  /** The data members
00059                   */
00060                 float   minSensorDistance;
00061                 float   maxSensorDistance;
00062                 float   sensorConeApperture;  //!< Cone aperture of each ultrasonic beam, in radians.
00063 
00064                 struct OBS_IMPEXP TMeasurement
00065                 {
00066                         TMeasurement() : sensorID(0), sensorPose(), sensedDistance(0)
00067                         {}
00068 
00069                         /** Some kind of sensor ID which identifies it on the bus (if applicable, 0 otherwise)
00070                           */
00071                         uint16_t        sensorID;
00072 
00073                         /** The 6D position of the sensor on the robot.
00074                           */
00075                         math::TPose3D   sensorPose;
00076 
00077                         /** The measured range, in meters (or a value of 0 if there was no detected echo).
00078                           */
00079                         float           sensedDistance;
00080                 };
00081 
00082                 typedef std::deque<TMeasurement>                    TMeasurementList;
00083                 typedef std::deque<TMeasurement>::const_iterator    const_iterator;
00084                 typedef std::deque<TMeasurement>::iterator          iterator;
00085 
00086                 TMeasurementList sensedData; //!< All the measurements
00087 
00088 
00089                 iterator begin() { return sensedData.begin(); }
00090                 iterator end() { return sensedData.end(); }
00091                 const_iterator begin() const { return sensedData.begin(); }
00092                 const_iterator end() const { return sensedData.end(); }
00093 
00094                 /** A general method to retrieve the sensor pose on the robot.
00095                   *  Note that most sensors will return a full (6D) CPose3D, but see the derived classes for more details or special cases.
00096                   * \sa setSensorPose
00097                   */
00098                 void getSensorPose( CPose3D &out_sensorPose ) const;
00099 
00100 
00101                 /** A general method to change the sensor pose on the robot.
00102                   *  Note that most sensors will use the full (6D) CPose3D, but see the derived classes for more details or special cases.
00103                   * \sa getSensorPose
00104                   */
00105                 void setSensorPose( const CPose3D &newSensorPose );
00106 
00107 
00108         }; // End of class def.
00109 
00110 
00111         } // End of namespace
00112 } // End of namespace
00113 
00114 #endif



Page generated by Doxygen 1.7.3 for MRPT 0.9.4 SVN: at Sat Mar 26 06:16:28 UTC 2011