Main MRPT website > C++ reference
MRPT logo
CObservationIMU.h
Go to the documentation of this file.
1 /* +---------------------------------------------------------------------------+
2  | The Mobile Robot Programming Toolkit (MRPT) C++ library |
3  | |
4  | http://www.mrpt.org/ |
5  | |
6  | Copyright (C) 2005-2012 University of Malaga |
7  | |
8  | This software was written by the Machine Perception and Intelligent |
9  | Robotics Lab, University of Malaga (Spain). |
10  | Contact: Jose-Luis Blanco <jlblanco@ctima.uma.es> |
11  | |
12  | This file is part of the MRPT project. |
13  | |
14  | MRPT is free software: you can redistribute it and/or modify |
15  | it under the terms of the GNU General Public License as published by |
16  | the Free Software Foundation, either version 3 of the License, or |
17  | (at your option) any later version. |
18  | |
19  | MRPT is distributed in the hope that it will be useful, |
20  | but WITHOUT ANY WARRANTY; without even the implied warranty of |
21  | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
22  | GNU General Public License for more details. |
23  | |
24  | You should have received a copy of the GNU General Public License |
25  | along with MRPT. If not, see <http://www.gnu.org/licenses/>. |
26  | |
27  +---------------------------------------------------------------------------+ */
28 #ifndef CObservationIMU_H
29 #define CObservationIMU_H
30 
32 #include <mrpt/math/CMatrixD.h>
33 #include <mrpt/slam/CObservation.h>
34 #include <mrpt/poses/CPose3D.h>
35 #include <mrpt/poses/CPose2D.h>
36 
37 namespace mrpt
38 {
39 namespace slam
40 {
41 
43 
44  /** Symbolic names for the indices of IMU data (refer to mrpt::slam::CObservationIMU)
45  * \ingroup mrpt_obs_grp
46  */
48  {
49  IMU_X_ACC = 0,
64 
65  // Always leave this last value to reflect the number of enum values:
67  };
68 
69  /** This class stores measurements from an Inertial Measurement Unit (IMU), and/or its attitude estimation (integration of raw measurements).
70  *
71  * The order of the 15 raw values in each entry of mrpt::slam::CObservationIMU::rawMeasurements is (you can use the TIMUDataIndex "enum" symbolic names):
72  <table>
73  <tr> <td> 0 </td> <td>IMU_X_ACC</td> <td> x-axis acceleration (m/sec<sup>2</sup>)</td> </tr>
74  <tr> <td> 1 </td> <td>IMU_Y_ACC</td> <td> y-axis acceleration (m/sec<sup>2</sup>)</td> </tr>
75  <tr> <td> 2 </td> <td>IMU_Z_ACC</td> <td> z-axis acceleration (m/sec<sup>2</sup>)</td> </tr>
76  <tr> <td> 3 </td> <td>IMU_YAW_VEL</td> <td> yaw angular velocity (rad/sec)</td> </tr>
77  <tr> <td> 4 </td> <td>IMU_PITCH_VEL</td> <td> pitch angular velocity (rad/sec)</td> </tr>
78  <tr> <td> 5 </td> <td>IMU_ROLL_VEL</td> <td> roll angular velocity (rad/sec)</td> </tr>
79  <tr> <td> 6 </td> <td>IMU_X_VEL</td> <td> x-axis velocity (m/sec)</td> </tr>
80  <tr> <td> 7 </td> <td>IMU_Y_VEL</td> <td> y-axis velocity (m/sec)</td> </tr>
81  <tr> <td> 8 </td> <td>IMU_Z_VEL</td> <td> z-axis velocity (m/sec)</td> </tr>
82  <tr> <td> 9 </td> <td>IMU_YAW</td> <td> yaw absolute value (rad)</td> </tr>
83  <tr> <td> 10 </td> <td>IMU_PITCH</td> <td> pitch absolute value (rad)</td> </tr>
84  <tr> <td> 11 </td> <td>IMU_ROLL</td> <td> roll absolute value (rad)</td> </tr>
85  <tr> <td> 12 </td> <td>IMU_X</td> <td> x absolute value (meters)</td> </tr>
86  <tr> <td> 13 </td> <td>IMU_Y</td> <td> y absolute value (meters)</td> </tr>
87  <tr> <td> 14 </td> <td>IMU_Z</td> <td> z absolute value (meters)</td> </tr>
88  </table>
89  *
90  * The first 6 values are directly measured by accelerometers & gyroscopes. The rest, if present, are estimates from the IMU unit.
91  *
92  * \sa CObservation
93  * \ingroup mrpt_obs_grp
94  */
96  {
97  // This must be added to any CSerializable derived class:
99 
100  public:
101  /** Constructor.
102  */
104  sensorPose(),
105  dataIsPresent(15,false),
106  rawMeasurements(15,0)
107  { }
108 
109  /** Destructor
110  */
111  virtual ~CObservationIMU()
112  { }
113 
114  /** The pose of the sensor on the robot.
115  */
117 
118  /** 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).
119  * See the top of this page for the meaning of the indices.
120  */
122 
123  /** The accelerometer and/or gyroscope measurements taken by the IMU at the given timestamp.
124  * \sa dataIsPresent, CObservation::timestamp
125  */
126  std::vector<double> rawMeasurements;
127 
128 
129  /** A general method to retrieve the sensor pose on the robot.
130  * Note that most sensors will return a full (6D) CPose3D, but see the derived classes for more details or special cases.
131  * \sa setSensorPose
132  */
133  void getSensorPose( CPose3D &out_sensorPose ) const { out_sensorPose = sensorPose; }
134 
135 
136  /** A general method to change the sensor pose on the robot.
137  * Note that most sensors will use the full (6D) CPose3D, but see the derived classes for more details or special cases.
138  * \sa getSensorPose
139  */
140  void setSensorPose( const CPose3D &newSensorPose ) { sensorPose = newSensorPose; }
141 
142 
143  }; // End of class def.
144 
145 
146  } // End of namespace
147 } // End of namespace
148 
149 #endif



Page generated by Doxygen 1.8.3 for MRPT 0.9.6 SVN: at Fri Feb 15 22:05:02 EST 2013