source: flair-dev/trunk/include/FlairCore/AhrsData.h @ 13

Last change on this file since 13 was 13, checked in by Bayard Gildas, 5 years ago

formatting script + include reformatted

File size: 4.0 KB
Line 
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}
5/*!
6 * \file AhrsData.h
7 * \brief Class defining AHRS datas
8 * \author Guillaume Sanahuja, Copyright Heudiasyc UMR UTC/CNRS 7253
9 * \date 2016/03/01
10 * \version 4.0
11 */
12#ifndef AHRSDATA_H
13#define AHRSDATA_H
14
15#include <io_data.h>
16#include <IODataElement.h>
17#include <Vector3D.h>
18#include <Quaternion.h>
19
20namespace flair {
21namespace core {
22
23/*! \class AhrsData
24*
25* \brief Class defining AHRS datas
26*
27* AHRS datas consist of quaternion and rotational angles values. \n
28*
29*/
30class AhrsData : public io_data {
31public:
32  class Type : public DataType {
33  public:
34    Type(const ScalarType &inElementDataType)
35        : elementDataType(inElementDataType) {}
36    const ScalarType &GetElementDataType() const { return elementDataType; }
37    std::string GetDescription() const { return "ahrs data"; }
38    size_t GetSize() const { return 7 * elementDataType.GetSize(); }
39
40  private:
41    const ScalarType &elementDataType;
42  };
43
44  /*!
45  \enum PlotableData_t
46  \brief Datas wich can be plotted in a DataPlot1D
47  */
48  typedef enum {
49    Roll /*! roll */,
50    Pitch /*! pitch */,
51    Yaw /*! yaw */,
52    RollDeg /*! roll degree*/,
53    PitchDeg /*! pitch degree */,
54    YawDeg /*! yaw degree */,
55    Q0 /*! quaternion 0 */,
56    Q1 /*! quaternion 1 */,
57    Q2 /*! quaternion 2 */,
58    Q3 /*! quaternion 3 */,
59    Wx /*! x filtered angular rate */,
60    Wy /*! y filtered angular rate */,
61    Wz /*! z filtered angular rate */,
62    WxDeg /*! x filtered angular rate degree*/,
63    WyDeg /*! y filtered angular rate degree*/,
64    WzDeg /*! z filtered angular rate degree*/,
65  } PlotableData_t;
66
67  /*!
68  * \brief Constructor
69  *
70  * Construct an io_data representing AHRS datas. \n
71  *
72  * \param parent parent
73  * \param name name
74  * \param n number of samples
75  */
76  AhrsData(const Object *parent, std::string name = "", int n = 1);
77
78  /*!
79  * \brief Destructor
80  *
81  */
82  ~AhrsData();
83
84  /*!
85  * \brief Element
86  *
87  * Get a pointer to a specific element. This pointer can be used for plotting.
88  *
89  * \param plotableData data type
90  *
91  * \return pointer to the element
92  */
93  IODataElement *Element(PlotableData_t plotableData) const;
94
95  /*!
96  * \brief Set quaternion
97  *
98  * This method is mutex protected.
99  *
100  * \param quaternion quaternion
101  *
102  */
103  void SetQuaternion(const Quaternion &quaternion);
104
105  /*!
106  * \brief Get quaternion
107  *
108  * This method is mutex protected.
109  *
110  * \return quaternion
111  *
112  */
113  Quaternion GetQuaternion(void) const;
114
115  /*!
116  * \brief Set angular rates
117  *
118  * This method is mutex protected.
119  *
120  * \param angularRates angular rates
121  *
122  */
123  void SetAngularRates(const Vector3D &angularRates);
124
125  /*!
126  * \brief Get angular rates
127  *
128  * This method is mutex protected.
129  *
130  * \return angular rates
131  *
132  */
133  Vector3D GetAngularRates(void) const;
134
135  /*!
136  * \brief Get both quaternion and angular rates
137  *
138  * This method is mutex protected.
139  *
140  * \param quaternion quaternion
141  * \param angularRates angular rates
142  *
143  */
144  void GetQuaternionAndAngularRates(Quaternion &quaternion,
145                                    Vector3D &angularRates) const;
146
147  /*!
148  * \brief Set both quaternion and angular rates
149  *
150  * This method is mutex protected.
151  *
152  * \param quaternion quaternion
153  * \param angularRates angular rates
154  *
155  */
156  void SetQuaternionAndAngularRates(const Quaternion &quaternion,
157                                    const Vector3D &angularRates);
158
159  const Type &GetDataType() const { return dataType; }
160
161private:
162  /*!
163  * \brief Copy datas
164  *
165  * Reimplemented from io_data. \n
166  * See io_data::CopyDatas.
167  *
168  * \param dst destination buffer
169  */
170  void CopyDatas(char *dst) const;
171
172  void Queue(char **dst, const void *src, size_t size) const;
173
174  /*!
175  * \brief %Quaternion
176  *
177  */
178  Quaternion quaternion;
179
180  /*!
181  * \brief Angular rates
182  *
183  */
184  Vector3D angularRates;
185
186  Type dataType;
187};
188
189} // end namespace core
190} // end namespace flair
191
192#endif // AHRSDATA_H
Note: See TracBrowser for help on using the repository browser.