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 CObservationIMU_H 00029 #define CObservationIMU_H 00030 00031 #include <mrpt/utils/CSerializable.h> 00032 #include <mrpt/math/CMatrixD.h> 00033 #include <mrpt/slam/CObservation.h> 00034 #include <mrpt/poses/CPose3D.h> 00035 #include <mrpt/poses/CPose2D.h> 00036 00037 namespace mrpt 00038 { 00039 namespace slam 00040 { 00041 00042 DEFINE_SERIALIZABLE_PRE_CUSTOM_BASE( CObservationIMU , CObservation ) 00043 00044 /** Symbolic names for the indices of IMU data (refer to mrpt::slam::CObservationIMU) 00045 */ 00046 enum TIMUDataIndex 00047 { 00048 IMU_X_ACC = 0, 00049 IMU_Y_ACC, 00050 IMU_Z_ACC, 00051 IMU_YAW_VEL, 00052 IMU_PITCH_VEL, 00053 IMU_ROLL_VEL, 00054 IMU_X_VEL, 00055 IMU_Y_VEL, 00056 IMU_Z_VEL, 00057 IMU_YAW, 00058 IMU_PITCH, 00059 IMU_ROLL, 00060 IMU_X, 00061 IMU_Y, 00062 IMU_Z 00063 }; 00064 00065 /** This class stores both sequences of raw measurements from an IMU, and/or its attitude estimation (integration of raw measurements). 00066 * 00067 * The order of the 15 raw values in each entry of mrpt::slam::CObservationIMU::rawMeasurements is (you can use the "enum" symbolic names): 00068 <table> 00069 <tr> <td> 0 </td> <td>IMU_X_ACC</td> <td> x-axis acceleration (m/sec²)</td> </tr> 00070 <tr> <td> 1 </td> <td>IMU_Y_ACC</td> <td> y-axis acceleration (m/sec²)</td> </tr> 00071 <tr> <td> 2 </td> <td>IMU_Z_ACC</td> <td> z-axis acceleration (m/sec²)</td> </tr> 00072 <tr> <td> 3 </td> <td>IMU_YAW_VEL</td> <td> yaw angular velocity (rad/sec)</td> </tr> 00073 <tr> <td> 4 </td> <td>IMU_PITCH_VEL</td> <td> pitch angular velocity (rad/sec)</td> </tr> 00074 <tr> <td> 5 </td> <td>IMU_ROLL_VEL</td> <td> roll angular velocity (rad/sec)</td> </tr> 00075 <tr> <td> 6 </td> <td>IMU_X_VEL</td> <td> x-axis velocity (m/sec)</td> </tr> 00076 <tr> <td> 7 </td> <td>IMU_Y_VEL</td> <td> y-axis velocity (m/sec)</td> </tr> 00077 <tr> <td> 8 </td> <td>IMU_Z_VEL</td> <td> z-axis velocity (m/sec)</td> </tr> 00078 <tr> <td> 9 </td> <td>IMU_YAW</td> <td> yaw absolute value (rad)</td> </tr> 00079 <tr> <td> 10 </td> <td>IMU_PITCH</td> <td> pitch absolute value (rad)</td> </tr> 00080 <tr> <td> 11 </td> <td>IMU_ROLL</td> <td> roll absolute value (rad)</td> </tr> 00081 <tr> <td> 12 </td> <td>IMU_X</td> <td> x absolute value (meters)</td> </tr> 00082 <tr> <td> 13 </td> <td>IMU_Y</td> <td> y absolute value (meters)</td> </tr> 00083 <tr> <td> 14 </td> <td>IMU_Z</td> <td> z absolute value (meters)</td> </tr> 00084 </table> 00085 * 00086 * The first 6 values are directly measured by accelerometers & gyroscopes. The rest, if present, are estimates from the IMU unit. 00087 * 00088 * \sa CObservation 00089 */ 00090 class MRPTDLLIMPEXP CObservationIMU : public CObservation 00091 { 00092 // This must be added to any CSerializable derived class: 00093 DEFINE_SERIALIZABLE( CObservationIMU ) 00094 00095 public: 00096 /** Constructor. 00097 */ 00098 CObservationIMU( ) : 00099 sensorPose(), 00100 dataIsPresent(15,false), 00101 rawMeasurements(15,0) 00102 { } 00103 00104 /** Destructor 00105 */ 00106 virtual ~CObservationIMU() 00107 { } 00108 00109 /** The pose of the sensor on the robot. 00110 */ 00111 CPose3D sensorPose; 00112 00113 /** Each of the 15 entries of this vector is true if the corresponding data index contains valid data (the IMU unit supplies that kind of data). 00114 * See the top of this page for the meaning of the indices. 00115 */ 00116 vector_bool dataIsPresent; 00117 00118 /** The sequence of accelerometers/gyroscopes measurements in time. 00119 * Each entry of rawMeasurements is a sequence of 15 values for each instant of time, and the time between entries is fixed, starting in 00120 * the CObservation::timestamp, and with a sampling period of periodBetweenMeasurements. 00121 * See the top of this page for further details on the contents of the vector. 00122 * \sa hasRawMeasurements,periodBetweenMeasurements 00123 */ 00124 std::vector<double> rawMeasurements; 00125 00126 00127 /** Implements the virtual method in charge of finding the likelihood between this 00128 * and another observation, probably only of the same derived class. The operator 00129 * may be asymmetric. 00130 * 00131 * \param anotherObs The other observation to compute likelihood with. 00132 * \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. 00133 * 00134 * \return Returns a likelihood measurement, in the range [0,1]. 00135 * \exception std::exception On any error, as another observation being of an invalid class. 00136 */ 00137 float likelihoodWith( const CObservation *anotherObs, const CPosePDF *anotherObsPose = NULL ) const; 00138 00139 /** A general method to retrieve the sensor pose on the robot. 00140 * Note that most sensors will return a full (6D) CPose3D, but see the derived classes for more details or special cases. 00141 * \sa setSensorPose 00142 */ 00143 void getSensorPose( CPose3D &out_sensorPose ) const { out_sensorPose = sensorPose; } 00144 00145 00146 /** A general method to change the sensor pose on the robot. 00147 * Note that most sensors will use the full (6D) CPose3D, but see the derived classes for more details or special cases. 00148 * \sa getSensorPose 00149 */ 00150 void setSensorPose( const CPose3D &newSensorPose ) { sensorPose = newSensorPose; } 00151 00152 00153 }; // End of class def. 00154 00155 00156 } // End of namespace 00157 } // End of namespace 00158 00159 #endif
Page generated by Doxygen 1.6.1 for MRPT 0.7.1 SVN: at Tue Dec 22 08:29:35 CET 2009 |