00001 /* +---------------------------------------------------------------------------+ 00002 | The Mobile Robot Programming Toolkit (MRPT) C++ library | 00003 | | 00004 | http://mrpt.sourceforge.net/ | 00005 | | 00006 | Copyright (C) 2005-2009 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( CObservationRange , CObservation ) 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 MRPTDLLIMPEXP 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; 00063 struct MRPTDLLIMPEXP TMeasurement 00064 { 00065 TMeasurement() : sensorID(0), sensorPose(), sensedDistance(0) 00066 {} 00067 00068 /** Some kind of sensor ID which identifies it on the bus (if applicable, 0 otherwise) 00069 */ 00070 uint16_t sensorID; 00071 00072 /** The 6D position of the sensor on the robot. 00073 */ 00074 math::TPose3D sensorPose; 00075 00076 /** The measured range, in meters. 00077 */ 00078 float sensedDistance; 00079 }; 00080 00081 typedef std::deque<TMeasurement> TMeasurementList; 00082 typedef std::deque<TMeasurement>::const_iterator const_iterator; 00083 typedef std::deque<TMeasurement>::iterator iterator; 00084 00085 TMeasurementList sensedData; //!< All the measurements 00086 00087 00088 iterator begin() { return sensedData.begin(); } 00089 iterator end() { return sensedData.end(); } 00090 const_iterator begin() const { return sensedData.begin(); } 00091 const_iterator end() const { return sensedData.end(); } 00092 00093 00094 /** Implements the virtual method in charge of finding the likelihood between this 00095 * and another observation, probably only of the same derived class. The operator 00096 * may be asymmetric. 00097 * 00098 * \param anotherObs The other observation to compute likelihood with. 00099 * \param anotherObsPose If known, the belief about the robot pose when the other observation was taken can be supplied here, or NULL if it is unknown. 00100 * 00101 * \return Returns a likelihood measurement, in the range [0,1]. 00102 * \exception std::exception On any error, as another observation being of an invalid class. 00103 */ 00104 float likelihoodWith( const CObservation *anotherObs, const CPosePDF *anotherObsPose = NULL ) const; 00105 00106 /** A general method to retrieve the sensor pose on the robot. 00107 * Note that most sensors will return a full (6D) CPose3D, but see the derived classes for more details or special cases. 00108 * \sa setSensorPose 00109 */ 00110 void getSensorPose( CPose3D &out_sensorPose ) const; 00111 00112 00113 /** A general method to change the sensor pose on the robot. 00114 * Note that most sensors will use the full (6D) CPose3D, but see the derived classes for more details or special cases. 00115 * \sa getSensorPose 00116 */ 00117 void setSensorPose( const CPose3D &newSensorPose ); 00118 00119 00120 }; // End of class def. 00121 00122 00123 } // End of namespace 00124 } // End of namespace 00125 00126 #endif
Page generated by Doxygen 1.5.7.1 for MRPT 0.7.1 SVN: at Mon Aug 17 23:02:22 EDT 2009 |