Main MRPT website > C++ reference
MRPT logo
CObservationIMU.h
Go to the documentation of this file.
1 /* +---------------------------------------------------------------------------+
2  | Mobile Robot Programming Toolkit (MRPT) |
3  | http://www.mrpt.org/ |
4  | |
5  | Copyright (c) 2005-2014, Individual contributors, see AUTHORS file |
6  | See: http://www.mrpt.org/Authors - All rights reserved. |
7  | Released under BSD License. See details in http://www.mrpt.org/License |
8  +---------------------------------------------------------------------------+ */
9 #ifndef CObservationIMU_H
10 #define CObservationIMU_H
11 
13 #include <mrpt/math/CMatrixD.h>
14 #include <mrpt/slam/CObservation.h>
15 #include <mrpt/poses/CPose3D.h>
16 #include <mrpt/poses/CPose2D.h>
17 
18 namespace mrpt
19 {
20 namespace slam
21 {
22 
23  DEFINE_SERIALIZABLE_PRE_CUSTOM_BASE_LINKAGE( CObservationIMU , CObservation,OBS_IMPEXP )
24 
25  /** Symbolic names for the indices of IMU data (refer to mrpt::slam::CObservationIMU)
26  * \ingroup mrpt_obs_grp
27  */
29  {
30  /// x-axis acceleration (m/sec<sup>2</sup>)
31  IMU_X_ACC = 0 ,
32  /// y-axis acceleration (m/sec<sup>2</sup>)
34  /// z-axis acceleration (m/sec<sup>2</sup>)
36  /// yaw angular velocity (rad/sec)
38  /// pitch angular velocity (rad/sec)
40  /// roll angular velocity (rad/sec)
42  /// x-axis velocity (m/sec)
44  /// y-axis velocity (m/sec)
46  /// z-axis velocity (m/sec)
48  /// yaw absolute value (rad)
50  /// pitch absolute value (rad)
52  /// roll absolute value (rad)
54  /// x absolute value (meters)
56  /// y absolute value (meters)
58  /// z absolute value (meters)
60  /// x magnetic field value (gauss)
62  /// y magnetic field value (gauss)
64  /// z magnetic field value (gauss)
66  /// air pressure (Pascals)
68  /// altitude from an altimeter (meters)
70  /// temperature (degrees Celsius)
72 
73  // Always leave this last value to reflect the number of enum values:
75  };
76 
77  /** This class stores measurements from an Inertial Measurement Unit (IMU) (attitude estimation, raw gyroscope and accelerometer values), altimeters or magnetometers.
78  *
79  * The order of the 21 raw values in each entry of mrpt::slam::CObservationIMU::rawMeasurements is (you can use the TIMUDataIndex "enum" symbolic names):
80  <table>
81  <tr> <td> 0 </td> <td>IMU_X_ACC</td> <td> x-axis acceleration (m/sec<sup>2</sup>)</td> </tr>
82  <tr> <td> 1 </td> <td>IMU_Y_ACC</td> <td> y-axis acceleration (m/sec<sup>2</sup>)</td> </tr>
83  <tr> <td> 2 </td> <td>IMU_Z_ACC</td> <td> z-axis acceleration (m/sec<sup>2</sup>)</td> </tr>
84  <tr> <td> 3 </td> <td>IMU_YAW_VEL</td> <td> yaw angular velocity (rad/sec)</td> </tr>
85  <tr> <td> 4 </td> <td>IMU_PITCH_VEL</td> <td> pitch angular velocity (rad/sec)</td> </tr>
86  <tr> <td> 5 </td> <td>IMU_ROLL_VEL</td> <td> roll angular velocity (rad/sec)</td> </tr>
87  <tr> <td> 6 </td> <td>IMU_X_VEL</td> <td> x-axis velocity (m/sec)</td> </tr>
88  <tr> <td> 7 </td> <td>IMU_Y_VEL</td> <td> y-axis velocity (m/sec)</td> </tr>
89  <tr> <td> 8 </td> <td>IMU_Z_VEL</td> <td> z-axis velocity (m/sec)</td> </tr>
90  <tr> <td> 9 </td> <td>IMU_YAW</td> <td> yaw absolute value (rad)</td> </tr>
91  <tr> <td> 10 </td> <td>IMU_PITCH</td> <td> pitch absolute value (rad)</td> </tr>
92  <tr> <td> 11 </td> <td>IMU_ROLL</td> <td> roll absolute value (rad)</td> </tr>
93  <tr> <td> 12 </td> <td>IMU_X</td> <td> x absolute value (meters)</td> </tr>
94  <tr> <td> 13 </td> <td>IMU_Y</td> <td> y absolute value (meters)</td> </tr>
95  <tr> <td> 14 </td> <td>IMU_Z</td> <td> z absolute value (meters)</td> </tr>
96  <tr> <td> 15 </td> <td>IMU_MAG_X</td> <td> x magnetic field value (gauss)</td> </tr>
97  <tr> <td> 16 </td> <td>IMU_MAG_X</td> <td> x magnetic field value (gauss)</td> </tr>
98  <tr> <td> 17 </td> <td>IMU_MAG_X</td> <td> x magnetic field value (gauss)</td> </tr>
99  <tr> <td> 18 </td> <td>IMU_PRESSURE</td> <td> air pressure (Pascals)</td> </tr>
100  <tr> <td> 19 </td> <td>IMU_ALTITUDE</td> <td>altitude from an altimeter (meters)</td> </tr>
101  <tr> <td> 20 </td> <td>IMU_TEMPERATURE</td> <td> temperature (degrees Celsius)</td> </tr>
102  </table>
103  *
104  * Values from 0 to 5 are direct measurements measured by accelerometers & gyroscopes.
105  * Values at indices from 6 to 14, if present, are estimates (dead reckoning) from the IMU unit.
106  *
107  * \sa CObservation
108  * \ingroup mrpt_obs_grp
109  */
111  {
112  // This must be added to any CSerializable derived class:
114 
115  public:
116  /** Constructor.
117  */
119  sensorPose(),
120  dataIsPresent(21,false),
121  rawMeasurements(21,0)
122  { }
123 
124  /** Destructor
125  */
127  { }
128 
129  /** The pose of the sensor on the robot.
130  */
132 
133  /** Each entry in this vector is true if the corresponding data index contains valid data (the IMU unit supplies that kind of data).
134  * See the top of this page for the meaning of the indices.
135  */
137 
138  /** The accelerometer and/or gyroscope measurements taken by the IMU at the given timestamp.
139  * \sa dataIsPresent, CObservation::timestamp
140  */
141  std::vector<double> rawMeasurements;
142 
143 
144  /** A general method to retrieve the sensor pose on the robot.
145  * Note that most sensors will return a full (6D) CPose3D, but see the derived classes for more details or special cases.
146  * \sa setSensorPose
147  */
148  void getSensorPose( CPose3D &out_sensorPose ) const { out_sensorPose = sensorPose; }
149 
150 
151  /** A general method to change the sensor pose on the robot.
152  * Note that most sensors will use the full (6D) CPose3D, but see the derived classes for more details or special cases.
153  * \sa getSensorPose
154  */
155  void setSensorPose( const CPose3D &newSensorPose ) { sensorPose = newSensorPose; }
156 
157 
158  }; // End of class def.
159  DEFINE_SERIALIZABLE_POST_CUSTOM_BASE_LINKAGE( CObservationIMU , CObservation,OBS_IMPEXP )
160 
161 
162  } // End of namespace
163 } // End of namespace
164 
165 #endif
x absolute value (meters)
z absolute value (meters)
x-axis velocity (m/sec)
temperature (degrees Celsius)
std::vector< double > rawMeasurements
The accelerometer and/or gyroscope measurements taken by the IMU at the given timestamp.
pitch absolute value (rad)
x magnetic field value (gauss)
TIMUDataIndex
Symbolic names for the indices of IMU data (refer to mrpt::slam::CObservationIMU) ...
altitude from an altimeter (meters)
y absolute value (meters)
z magnetic field value (gauss)
#define DEFINE_SERIALIZABLE_PRE_CUSTOM_BASE_LINKAGE(class_name, base_name, _LINKAGE_)
This declaration must be inserted in all CSerializable classes definition, before the class declarati...
yaw absolute value (rad)
air pressure (Pascals)
pitch angular velocity (rad/sec)
Declares a class that represents any robot's observation.
Definition: CObservation.h:52
z-axis velocity (m/sec)
std::vector< bool > vector_bool
A type for passing a vector of bools.
virtual ~CObservationIMU()
Destructor.
y magnetic field value (gauss)
vector_bool dataIsPresent
Each entry in this vector is true if the corresponding data index contains valid data (the IMU unit s...
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
#define DEFINE_SERIALIZABLE(class_name)
This declaration must be inserted in all CSerializable classes definition, within the class declarati...
x-axis acceleration (m/sec2)
y-axis velocity (m/sec)
A class used to store a 3D pose (a 3D translation + a rotation in 3D).
Definition: CPose3D.h:69
This class stores measurements from an Inertial Measurement Unit (IMU) (attitude estimation, raw gyroscope and accelerometer values), altimeters or magnetometers.
void getSensorPose(CPose3D &out_sensorPose) const
A general method to retrieve the sensor pose on the robot.
CPose3D sensorPose
The pose of the sensor on the robot.
yaw angular velocity (rad/sec)
void setSensorPose(const CPose3D &newSensorPose)
A general method to change the sensor pose on the robot.
roll angular velocity (rad/sec)
#define DEFINE_SERIALIZABLE_POST_CUSTOM_BASE_LINKAGE(class_name, base_name, _LINKAGE_)
y-axis acceleration (m/sec2)
z-axis acceleration (m/sec2)
roll absolute value (rad)



Page generated by Doxygen 1.8.8 for MRPT 1.2.2 SVN:Unversioned directory at Tue Oct 14 02:14:08 UTC 2014