source: flair-src/trunk/lib/FlairCore/src/AhrsData.h@ 411

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

change io_data CopyDate to RawRead

File size: 4.0 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 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
[15]20namespace flair {
21namespace core {
[2]22
[15]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(); }
[2]39
[15]40 private:
41 const ScalarType &elementDataType;
42 };
[2]43
[15]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;
[2]66
[15]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);
[2]77
[15]78 /*!
79 * \brief Destructor
80 *
81 */
82 ~AhrsData();
[2]83
[15]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;
[2]94
[15]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);
[2]104
[15]105 /*!
106 * \brief Get quaternion
107 *
108 * This method is mutex protected.
109 *
110 * \return quaternion
111 *
112 */
113 Quaternion GetQuaternion(void) const;
[2]114
[15]115 /*!
116 * \brief Set angular rates
117 *
118 * This method is mutex protected.
119 *
120 * \param angularRates angular rates
121 *
122 */
[167]123 void SetAngularRates(const Vector3Df &angularRates);
[2]124
[15]125 /*!
126 * \brief Get angular rates
127 *
128 * This method is mutex protected.
129 *
130 * \return angular rates
131 *
132 */
[167]133 Vector3Df GetAngularRates(void) const;
[2]134
[15]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,
[167]145 Vector3Df &angularRates) const;
[2]146
[15]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,
[167]157 const Vector3Df &angularRates);
[2]158
[15]159 const Type &GetDataType() const { return dataType; }
[2]160
[15]161private:
162 /*!
[252]163 * \brief Raw read datas
[15]164 *
165 * Reimplemented from io_data. \n
[252]166 * See io_data::RawRead.
[15]167 *
168 * \param dst destination buffer
169 */
[252]170 void RawRead(char *dst) const;
[2]171
[15]172 void Queue(char **dst, const void *src, size_t size) const;
[2]173
[15]174 /*!
175 * \brief %Quaternion
176 *
177 */
178 Quaternion quaternion;
[2]179
[15]180 /*!
181 * \brief Angular rates
182 *
183 */
[167]184 Vector3Df angularRates;
[15]185
186 Type dataType;
187};
188
[2]189} // end namespace core
190} // end namespace flair
191
192#endif // AHRSDATA_H
Note: See TracBrowser for help on using the repository browser.