00001 /* +---------------------------------------------------------------------------+ 00002 | The Mobile Robot Programming Toolkit (MRPT) C++ library | 00003 | | 00004 | http://mrpt.sourceforge.net/ | 00005 | | 00006 | Copyright (C) 2005-2010 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 CObservationBearingRange_H 00029 #define CObservationBearingRange_H 00030 00031 #include <mrpt/utils/CSerializable.h> 00032 #include <mrpt/slam/CObservation.h> 00033 #include <mrpt/poses/CPose3D.h> 00034 #include <mrpt/slam/CLandmark.h> 00035 00036 namespace mrpt 00037 { 00038 namespace slam 00039 { 00040 DEFINE_SERIALIZABLE_PRE_CUSTOM_BASE( CObservationBearingRange , CObservation ) 00041 00042 /** This observation represents a number of range-bearing value pairs, each one for a detected landmark, which optionally can have identification IDs. 00043 * This class can manage sensors that detect landmarks in a 2D plane (e.g. a laser scanner) or in the 3D space (e.g. a camera). There are 00044 * two direction angles: yaw (azimuth) and pitch (negative elevation). For 2D sensors, the pitch must be always set to 0. 00045 * See CObservationBearingRange::validCovariances for the instructions to fill the uncertainty covariances. 00046 * \sa CObservation 00047 */ 00048 class MRPTDLLIMPEXP CObservationBearingRange : public CObservation 00049 { 00050 // This must be added to any CSerializable derived class: 00051 DEFINE_SERIALIZABLE( CObservationBearingRange ) 00052 00053 public: 00054 /** Default constructor. 00055 */ 00056 CObservationBearingRange( ); 00057 00058 float minSensorDistance, maxSensorDistance; //! Information about the sensor: Ranges, in meters (0: there is no limits) 00059 float fieldOfView_yaw; //!< Information about the sensor: The "field-of-view" of the sensor, in radians (for yaw ). 00060 float fieldOfView_pitch; //!< Information about the sensor: The "field-of-view" of the sensor, in radians (for yaw ). 00061 00062 /** The position of the sensor on the robot. 00063 */ 00064 CPose3D sensorLocationOnRobot; 00065 00066 /** Each one of the measurements: 00067 */ 00068 struct MRPTDLLIMPEXP TMeasurement 00069 { 00070 /** The sensed landmark distance, in meters. 00071 */ 00072 float range; 00073 00074 /** The sensed landmark direction, in radians, measured as the yaw (azimuth) and pitch (negative elevation). 00075 * See mrpt::poses::CPose3D for a definition of the 3D angles. 00076 */ 00077 float yaw,pitch; 00078 00079 /** The ID of the sensed beacon, or INVALID_LANDMARK_ID (-1) if the sensor does not identify the landmark. 00080 */ 00081 int32_t landmarkID; 00082 00083 /** The covariance matrix of the landmark. 00084 */ 00085 CMatrixDouble33 covariance; 00086 }; 00087 00088 typedef std::vector<TMeasurement> TMeasurementList; 00089 00090 /** The list of observed ranges: */ 00091 TMeasurementList sensedData; 00092 00093 /** True: The individual 3x3 covariance matrices must be taken into account, false (default): All the measurements have identical, diagonal 3x3 covariance matrices given by the values sensor_std_range,sensor_std_yaw,sensor_std_pitch. 00094 */ 00095 bool validCovariances; 00096 00097 /** Taken into account only if validCovariances=false: the standard deviation of the sensor noise model for range,yaw and pitch (in meters and radians). 00098 * If validCovariances=true, these 3 values are ignored and the individual 3x3 covariance matrices contain the actual uncertainties for each of the detected landmarks. 00099 */ 00100 float sensor_std_range,sensor_std_yaw,sensor_std_pitch; 00101 00102 /** Implements the virtual method in charge of finding the likelihood between this 00103 * and another observation, probably only of the same derived class. The operator 00104 * may be asymmetric. 00105 * 00106 * \param anotherObs The other observation to compute likelihood with. 00107 * \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. 00108 * 00109 * \return Returns a likelihood measurement, in the range [0,1]. 00110 * \exception std::exception On any error, as another observation being of an invalid class. 00111 */ 00112 float likelihoodWith( const CObservation *anotherObs, const CPosePDF *anotherObsPose = NULL ) const; 00113 00114 00115 /** Prints out the contents of the object. 00116 */ 00117 void debugPrintOut(); 00118 00119 /** A general method to retrieve the sensor pose on the robot. 00120 * Note that most sensors will return a full (6D) CPose3D, but see the derived classes for more details or special cases. 00121 * \sa setSensorPose 00122 */ 00123 void getSensorPose( CPose3D &out_sensorPose ) const { out_sensorPose = sensorLocationOnRobot; } 00124 00125 00126 /** A general method to change the sensor pose on the robot. 00127 * Note that most sensors will use the full (6D) CPose3D, but see the derived classes for more details or special cases. 00128 * \sa getSensorPose 00129 */ 00130 void setSensorPose( const CPose3D &newSensorPose ) { sensorLocationOnRobot = newSensorPose; } 00131 00132 00133 }; // End of class def. 00134 00135 00136 } // End of namespace 00137 } // End of namespace 00138 00139 #endif
| Page generated by Doxygen 1.6.2 for MRPT 0.8.1 SVN:exported at Mon Feb 15 22:01:07 UTC 2010 |
