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

Last change on this file since 9 was 2, checked in by Sanahuja Guillaume, 9 years ago

initial commit flaircore

File size: 5.1 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 { namespace core {
21
22 /*! \class AhrsData
23 *
24 * \brief Class defining AHRS datas
25 *
26 * AHRS datas consist of quaternion and rotational angles values. \n
27 *
28 */
29 class AhrsData: public io_data {
30 public:
31 class Type: public DataType {
32 public:
33 Type(const ScalarType &inElementDataType):
34 elementDataType(inElementDataType) {}
35 const ScalarType &GetElementDataType() const {return elementDataType;}
36 std::string GetDescription() const {return "ahrs data";}
37 size_t GetSize() const {
38 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 */, Pitch/*! pitch */, Yaw/*! yaw */,
50 RollDeg/*! roll degree*/, PitchDeg/*! pitch degree */, YawDeg/*! yaw degree */,
51 Q0/*! quaternion 0 */, Q1/*! quaternion 1 */, Q2/*! quaternion 2 */, Q3/*! quaternion 3 */,
52 Wx/*! x filtered angular rate */, Wy/*! y filtered angular rate */, Wz/*! z filtered angular rate */,
53 WxDeg/*! x filtered angular rate degree*/, WyDeg/*! y filtered angular rate degree*/, WzDeg/*! z filtered angular rate degree*/,
54 } PlotableData_t;
55
56 /*!
57 * \brief Constructor
58 *
59 * Construct an io_data representing AHRS datas. \n
60 *
61 * \param parent parent
62 * \param name name
63 * \param n number of samples
64 */
65 AhrsData(const Object* parent,std::string name="",int n=1);
66
67 /*!
68 * \brief Destructor
69 *
70 */
71 ~AhrsData();
72
73 /*!
74 * \brief Element
75 *
76 * Get a pointer to a specific element. This pointer can be used for plotting.
77 *
78 * \param plotableData data type
79 *
80 * \return pointer to the element
81 */
82 IODataElement *Element(PlotableData_t plotableData) const;
83
84 /*!
85 * \brief Set quaternion
86 *
87 * This method is mutex protected.
88 *
89 * \param quaternion quaternion
90 *
91 */
92 void SetQuaternion(const Quaternion &quaternion);
93
94 /*!
95 * \brief Get quaternion
96 *
97 * This method is mutex protected.
98 *
99 * \return quaternion
100 *
101 */
102 Quaternion GetQuaternion(void) const;
103
104 /*!
105 * \brief Set angular rates
106 *
107 * This method is mutex protected.
108 *
109 * \param angularRates angular rates
110 *
111 */
112 void SetAngularRates(const Vector3D &angularRates);
113
114 /*!
115 * \brief Get angular rates
116 *
117 * This method is mutex protected.
118 *
119 * \return angular rates
120 *
121 */
122 Vector3D GetAngularRates(void) const;
123
124 /*!
125 * \brief Get both quaternion and angular rates
126 *
127 * This method is mutex protected.
128 *
129 * \param quaternion quaternion
130 * \param angularRates angular rates
131 *
132 */
133 void GetQuaternionAndAngularRates(Quaternion &quaternion,Vector3D &angularRates) const;
134
135 /*!
136 * \brief Set 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 SetQuaternionAndAngularRates(const Quaternion &quaternion,const Vector3D &angularRates);
145
146 const Type &GetDataType() const {return dataType;}
147 private:
148 /*!
149 * \brief Copy datas
150 *
151 * Reimplemented from io_data. \n
152 * See io_data::CopyDatas.
153 *
154 * \param dst destination buffer
155 */
156 void CopyDatas(char *dst) const;
157
158 void Queue(char **dst,const void *src,size_t size) const;
159
160 /*!
161 * \brief %Quaternion
162 *
163 */
164 Quaternion quaternion;
165
166 /*!
167 * \brief Angular rates
168 *
169 */
170 Vector3D angularRates;
171
172 Type dataType;
173 };
174
175} // end namespace core
176} // end namespace flair
177
178#endif // AHRSDATA_H
Note: See TracBrowser for help on using the repository browser.