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://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 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          * \ingroup mrpt_obs_grp
00048          */
00049         class OBS_IMPEXP CObservationRange : public CObservation
00050         {
00051                 // This must be added to any CSerializable derived class:
00052                 DEFINE_SERIALIZABLE( CObservationRange )
00053 
00054          public:
00055                 /** Default constructor.
00056                  */
00057                 CObservationRange( );
00058 
00059                  /** The data members
00060                   */
00061                 float   minSensorDistance;
00062                 float   maxSensorDistance;
00063                 float   sensorConeApperture;  //!< Cone aperture of each ultrasonic beam, in radians.
00064 
00065                 struct OBS_IMPEXP TMeasurement
00066                 {
00067                         TMeasurement() : sensorID(0), sensorPose(), sensedDistance(0)
00068                         {}
00069 
00070                         /** Some kind of sensor ID which identifies it on the bus (if applicable, 0 otherwise)
00071                           */
00072                         uint16_t        sensorID;
00073 
00074                         /** The 6D position of the sensor on the robot.
00075                           */
00076                         math::TPose3D   sensorPose;
00077 
00078                         /** The measured range, in meters (or a value of 0 if there was no detected echo).
00079                           */
00080                         float           sensedDistance;
00081                 };
00082 
00083                 typedef std::deque<TMeasurement>                    TMeasurementList;
00084                 typedef std::deque<TMeasurement>::const_iterator    const_iterator;
00085                 typedef std::deque<TMeasurement>::iterator          iterator;
00086 
00087                 TMeasurementList sensedData; //!< All the measurements
00088 
00089 
00090                 iterator begin() { return sensedData.begin(); }
00091                 iterator end() { return sensedData.end(); }
00092                 const_iterator begin() const { return sensedData.begin(); }
00093                 const_iterator end() const { return sensedData.end(); }
00094 
00095                 /** A general method to retrieve the sensor pose on the robot.
00096                   *  Note that most sensors will return a full (6D) CPose3D, but see the derived classes for more details or special cases.
00097                   * \sa setSensorPose
00098                   */
00099                 void getSensorPose( CPose3D &out_sensorPose ) const;
00100 
00101 
00102                 /** A general method to change the sensor pose on the robot.
00103                   *  Note that most sensors will use the full (6D) CPose3D, but see the derived classes for more details or special cases.
00104                   * \sa getSensorPose
00105                   */
00106                 void setSensorPose( const CPose3D &newSensorPose );
00107 
00108 
00109         }; // End of class def.
00110 
00111 
00112         } // End of namespace
00113 } // End of namespace
00114 
00115 #endif



Page generated by Doxygen 1.7.5 for MRPT 0.9.5 SVN: at Thu Oct 13 21:25:36 UTC 2011