Main MRPT website > C++ reference
MRPT logo

CObservationIMU.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 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_LINKAGE( CObservationIMU , CObservation,OBS_IMPEXP )
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 measurements from an Inertial Measurement Unit (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 TIMUDataIndex "enum" symbolic names):
00068                 <table>
00069                 <tr> <td> 0 </td> <td>IMU_X_ACC</td> <td> x-axis acceleration (m/sec<sup>2</sup>)</td> </tr>
00070                 <tr> <td> 1 </td> <td>IMU_Y_ACC</td> <td> y-axis acceleration (m/sec<sup>2</sup>)</td> </tr>
00071                 <tr> <td> 2 </td> <td>IMU_Z_ACC</td> <td> z-axis acceleration (m/sec<sup>2</sup>)</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 OBS_IMPEXP 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 accelerometer and/or gyroscope measurements taken by the IMU at the given timestamp.
00119                   * \sa dataIsPresent, CObservation::timestamp
00120                   */
00121                 std::vector<double>  rawMeasurements;
00122 
00123 
00124                 /** A general method to retrieve the sensor pose on the robot.
00125                   *  Note that most sensors will return a full (6D) CPose3D, but see the derived classes for more details or special cases.
00126                   * \sa setSensorPose
00127                   */
00128                 void getSensorPose( CPose3D &out_sensorPose ) const { out_sensorPose = sensorPose; }
00129 
00130 
00131                 /** A general method to change the sensor pose on the robot.
00132                   *  Note that most sensors will use the full (6D) CPose3D, but see the derived classes for more details or special cases.
00133                   * \sa getSensorPose
00134                   */
00135                 void setSensorPose( const CPose3D &newSensorPose ) { sensorPose = newSensorPose; }
00136 
00137 
00138         }; // End of class def.
00139 
00140 
00141         } // End of namespace
00142 } // End of namespace
00143 
00144 #endif



Page generated by Doxygen 1.7.3 for MRPT 0.9.4 SVN:exported at Tue Jan 25 21:56:31 UTC 2011