Flair
Framework Libre Air
ImuData.h
Go to the documentation of this file.
1 // %flair:license{
2 // This file is part of the Flair framework distributed under the
3 // CECILL-C License, Version 1.0.
4 // %flair:license}
12 #ifndef IMUDATA_H
13 #define IMUDATA_H
14 
15 #include <io_data.h>
16 #include <IODataElement.h>
17 #include <Vector3D.h>
18 
19 namespace flair {
20 namespace core {
21 
31 class ImuData : public io_data {
32 public:
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  }
46 
47  private:
48  ScalarType const &elementDataType;
49  };
50 
55  typedef enum {
69 
79  ImuData(const Object *parent, std::string name = "", int n = 1);
80 
85  ~ImuData();
86 
96  IODataElement *Element(PlotableData_t data_type) const;
97 
106  Vector3Df GetRawAcc(void) const;
107 
116  Vector3Df GetRawMag(void) const;
117 
126  Vector3Df GetRawGyr(void) const;
127 
138  void GetRawAccMagAndGyr(Vector3Df &rawAcc, Vector3Df &rawMag,
139  Vector3Df &rawGyr) const;
140 
149  void SetRawAcc(const Vector3Df &rawAcc);
150 
159  void SetRawMag(const Vector3Df &rawMag);
160 
169  void SetRawGyr(const Vector3Df &rawGyr);
170 
181  void SetRawAccMagAndGyr(const Vector3Df &rawAcc, const Vector3Df &rawMag,
182  const Vector3Df &rawGyr);
183 
184  Type const &GetDataType() const { return dataType; }
185 
186 private:
195  void RawRead(char *dst) const;
196 
201  Vector3Df rawAcc;
202 
207  Vector3Df rawGyr;
208 
213  Vector3Df rawMag;
214 
215  void Queue(char **dst, const void *src, size_t size) const;
216  Type dataType;
217 };
218 
219 } // end namespace core
220 } // end namespace flair
221 
222 #endif // IMUDATA_H
Abstract class for data types.
Definition: io_data.h:94
Definition: ImuData.h:57
Definition: ImuData.h:59
Definition: io_data.h:26
Base class for all Framework's classes.
Definition: Object.h:83
namespace of the flair Framework
Definition: Ahrs.h:19
Definition: ImuData.h:66
void GetRawAccMagAndGyr(Vector3Df &rawAcc, Vector3Df &rawMag, Vector3Df &rawGyr) const
Get raw accelerations, magnetometers and angular speeds.
Vector3Df GetRawAcc(void) const
Get raw accelerations.
Abstract class for data types.
Class defining a 3D vector.
Definition: ImuData.h:33
void SetRawAcc(const Vector3Df &rawAcc)
Set raw accelerations.
Definition: ImuData.h:67
Definition: ImuData.h:58
Definition: ImuData.h:56
Abstract class for accessing an element of an io_data.
PlotableData_t
Datas wich can be plotted in a DataPlot1D.
Definition: ImuData.h:55
Definition: ImuData.h:64
Vector3Df GetRawGyr(void) const
Get raw angular speed.
Definition: io_data.h:40
Definition: ImuData.h:65
Definition: ImuData.h:63
Definition: ImuData.h:61
~ImuData()
Destructor.
Vector3Df GetRawMag(void) const
Get raw magnetometers.
void SetRawMag(const Vector3Df &rawMag)
Set raw magnetometers.
void SetRawAccMagAndGyr(const Vector3Df &rawAcc, const Vector3Df &rawMag, const Vector3Df &rawGyr)
Set raw accelerations, magnetometers and angular speeds.
void SetRawGyr(const Vector3Df &rawGyr)
Set raw angular speed.
Definition: ImuData.h:60
IODataElement * Element(PlotableData_t data_type) const
Element.
Abstract class for accessing an element of an io_data.
Definition: IODataElement.h:27
Definition: ImuData.h:62
ImuData(const Object *parent, std::string name="", int n=1)
Constructor.
Class defining IMU datas.
Definition: ImuData.h:31