source: flair-src/trunk/lib/FlairCore/src/ImuData.h@ 442

Last change on this file since 442 was 252, checked in by Sanahuja Guillaume, 6 years ago

change io_data CopyDate to RawRead

File size: 4.5 KB
RevLine 
[2]1// %flair:license{
[15]2// This file is part of the Flair framework distributed under the
3// CECILL-C License, Version 1.0.
[2]4// %flair:license}
5/*!
6 * \file ImuData.h
7 * \brief Class defining IMU datas
8 * \author Guillaume Sanahuja, Copyright Heudiasyc UMR UTC/CNRS 7253
9 * \date 2014/01/15
10 * \version 4.0
11 */
12#ifndef IMUDATA_H
13#define IMUDATA_H
14
15#include <io_data.h>
16#include <IODataElement.h>
17#include <Vector3D.h>
18
[15]19namespace flair {
20namespace core {
[2]21
[15]22/*! \class ImuData
23*
24* \brief Class defining IMU datas
25*
26* IMU (inertial measurement unit) datas consist of raw accelerometer values, raw
27*gyrometer values
28* and raw magnetometer values.
29*
30*/
31class ImuData : public io_data {
32public:
33 class Type : public DataType {
34 public:
35 Type(ScalarType const &_elementDataType)
36 : elementDataType(_elementDataType) {}
37 ScalarType const &GetElementDataType() const { return elementDataType; }
38 std::string GetDescription() const { return "imu data"; }
39 size_t GetSize() const {
40 size_t size = 0;
41 size += 3 * elementDataType.GetSize(); // RawAcc
42 size += 3 * elementDataType.GetSize(); // RawGyr
43 size += 3 * elementDataType.GetSize(); // RawMag
44 return size;
45 }
[2]46
[15]47 private:
48 ScalarType const &elementDataType;
49 };
[2]50
[15]51 /*!
52 \enum PlotableData_t
53 \brief Datas wich can be plotted in a DataPlot1D
54 */
55 typedef enum {
56 RawAx /*! x raw accelerometer */,
57 RawAy /*! y raw accelerometer */,
58 RawAz /*! z raw accelerometer */,
59 RawGx /*! x raw gyrometer */,
60 RawGy /*! y raw gyrometer */,
61 RawGz /*! z raw gyrometer */,
62 RawGxDeg /*! x raw gyrometer degree */,
63 RawGyDeg /*! y raw gyrometer degree */,
64 RawGzDeg /*! z raw gyrometer degree */,
65 RawMx /*! x raw magnetometer */,
66 RawMy /*! y raw magnetometer */,
67 RawMz /*! z raw magnetometer */
68 } PlotableData_t;
[2]69
[15]70 /*!
71 * \brief Constructor
72 *
73 * Construct an io_data representing IMU datas. \n
74 *
75 * \param parent parent
76 * \param name name
77 * \param n number of samples
78 */
79 ImuData(const Object *parent, std::string name = "", int n = 1);
[2]80
[15]81 /*!
82 * \brief Destructor
83 *
84 */
85 ~ImuData();
[2]86
[15]87 /*!
88 * \brief Element
89 *
90 * Get a pointer to a specific element. This pointer can be used for plotting.
91 *
92 * \param data_type data type
93 *
94 * \return pointer to the element
95 */
96 IODataElement *Element(PlotableData_t data_type) const;
[2]97
[15]98 /*!
99 * \brief Get raw accelerations
100 *
101 * This method is mutex protected.
102 *
103 * \return raw accelerations
104 *
105 */
[167]106 Vector3Df GetRawAcc(void) const;
[2]107
[15]108 /*!
109 * \brief Get raw magnetometers
110 *
111 * This method is mutex protected.
112 *
113 * \return raw magnetometers
114 *
115 */
[167]116 Vector3Df GetRawMag(void) const;
[2]117
[15]118 /*!
119 * \brief Get raw angular speed
120 *
121 * This method is mutex protected.
122 *
123 * \return raw angular speed
124 *
125 */
[167]126 Vector3Df GetRawGyr(void) const;
[2]127
[15]128 /*!
129 * \brief Get raw accelerations, magnetometers and angular speeds
130 *
131 * This method is mutex protected.
132 *
133 * \param rawAcc raw accelerations
134 * \param rawMag raw magnetometers
135 * \param rawGyr raw angular speeds
136 *
137 */
[167]138 void GetRawAccMagAndGyr(Vector3Df &rawAcc, Vector3Df &rawMag,
139 Vector3Df &rawGyr) const;
[2]140
[15]141 /*!
142 * \brief Set raw accelerations
143 *
144 * This method is mutex protected.
145 *
146 * \param raw accelerations
147 *
148 */
[167]149 void SetRawAcc(const Vector3Df &rawAcc);
[2]150
[15]151 /*!
152 * \brief Set raw magnetometers
153 *
154 * This method is mutex protected.
155 *
156 * \param raw magnetometers
157 *
158 */
[167]159 void SetRawMag(const Vector3Df &rawMag);
[2]160
[15]161 /*!
162 * \brief Set raw angular speed
163 *
164 * This method is mutex protected.
165 *
166 * \param raw angular speed
167 *
168 */
[167]169 void SetRawGyr(const Vector3Df &rawGyr);
[2]170
[15]171 /*!
172 * \brief Set raw accelerations, magnetometers and angular speeds
173 *
174 * This method is mutex protected.
175 *
176 * \param rawAcc raw accelerations
177 * \param rawMag raw magnetometers
178 * \param rawGyr raw angular speeds
179 *
180 */
[167]181 void SetRawAccMagAndGyr(const Vector3Df &rawAcc, const Vector3Df &rawMag,
182 const Vector3Df &rawGyr);
[2]183
[15]184 Type const &GetDataType() const { return dataType; }
[2]185
[15]186private:
187 /*!
[252]188 * \brief Raw read datas
[15]189 *
190 * Reimplemented from io_data. \n
[252]191 * See io_data::RawRead.
[15]192 *
193 * \param dst destination buffer
194 */
[252]195 void RawRead(char *dst) const;
[2]196
[15]197 /*!
198 * \brief Raw accelerometer
199 *
200 */
[167]201 Vector3Df rawAcc;
[2]202
[15]203 /*!
204 * \brief Raw gyrometer
205 *
206 */
[167]207 Vector3Df rawGyr;
[2]208
[15]209 /*!
210 * \brief Raw magnetometer
211 *
212 */
[167]213 Vector3Df rawMag;
[2]214
[15]215 void Queue(char **dst, const void *src, size_t size) const;
216 Type dataType;
217};
218
[2]219} // end namespace core
220} // end namespace flair
221
222#endif // IMUDATA_H
Note: See TracBrowser for help on using the repository browser.