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 Imu.h
|
---|
7 | * \brief Base class for Imu
|
---|
8 | * \author Guillaume Sanahuja, Copyright Heudiasyc UMR UTC/CNRS 7253
|
---|
9 | * \date 2014/01/16
|
---|
10 | * \version 4.0
|
---|
11 | */
|
---|
12 |
|
---|
13 | #ifndef IMU_H
|
---|
14 | #define IMU_H
|
---|
15 |
|
---|
16 | #include <IODevice.h>
|
---|
17 | #include <Vector3D.h>
|
---|
18 |
|
---|
19 | namespace flair {
|
---|
20 | namespace core {
|
---|
21 | class ImuData;
|
---|
22 | class OneAxisRotation;
|
---|
23 | }
|
---|
24 | namespace gui {
|
---|
25 | class Tab;
|
---|
26 | class TabWidget;
|
---|
27 | class GroupBox;
|
---|
28 | class Layout;
|
---|
29 | class DataPlot1D;
|
---|
30 | }
|
---|
31 | }
|
---|
32 |
|
---|
33 | class Ahrs_impl;
|
---|
34 |
|
---|
35 | namespace flair {
|
---|
36 | namespace sensor {
|
---|
37 | /*! \class Imu
|
---|
38 | *
|
---|
39 | * \brief Base class for Imu
|
---|
40 | *
|
---|
41 | * Use this class to define a custom Imu.
|
---|
42 | *
|
---|
43 | */
|
---|
44 | class Imu : public core::IODevice {
|
---|
45 | friend class ::Ahrs_impl;
|
---|
46 |
|
---|
47 | public:
|
---|
48 | /*!
|
---|
49 | * \brief Constructor
|
---|
50 | *
|
---|
51 | * Construct an Imu.
|
---|
52 | * It will be child of the FrameworkManager.
|
---|
53 | *
|
---|
54 | * \param name name
|
---|
55 | */
|
---|
56 | Imu(std::string name);
|
---|
57 |
|
---|
58 | /*!
|
---|
59 | * \brief Constructor
|
---|
60 | *
|
---|
61 | * Construct an Imu. \n
|
---|
62 | * This contructor must only be called for a simulated device.
|
---|
63 | *
|
---|
64 | * \param parent parent
|
---|
65 | * \param name name
|
---|
66 | */
|
---|
67 | Imu(const core::IODevice *parent, std::string name);
|
---|
68 |
|
---|
69 | /*!
|
---|
70 | * \brief Destructor
|
---|
71 | *
|
---|
72 | */
|
---|
73 | ~Imu();
|
---|
74 |
|
---|
75 | /*!
|
---|
76 | * \brief Get IMU datas
|
---|
77 | *
|
---|
78 | * \return ImuData
|
---|
79 | */
|
---|
80 | const core::ImuData *GetDatas(void) const;
|
---|
81 |
|
---|
82 |
|
---|
83 | /*!
|
---|
84 | * \brief Setup Layout
|
---|
85 | *
|
---|
86 | * \return setup Layout
|
---|
87 | */
|
---|
88 | gui::Layout *GetLayout(void) const;
|
---|
89 |
|
---|
90 | /*!
|
---|
91 | * \brief Lock user interface
|
---|
92 | *
|
---|
93 | */
|
---|
94 | void LockUserInterface(void) const;
|
---|
95 |
|
---|
96 | /*!
|
---|
97 | * \brief Unlock user interface
|
---|
98 | *
|
---|
99 | */
|
---|
100 | void UnlockUserInterface(void) const;
|
---|
101 |
|
---|
102 | /*!
|
---|
103 | * \brief Use default plot
|
---|
104 | *
|
---|
105 | */
|
---|
106 | void UseDefaultPlot(void);
|
---|
107 |
|
---|
108 | /*!
|
---|
109 | * \brief Plot tab
|
---|
110 | *
|
---|
111 | * \return plot Tab
|
---|
112 | */
|
---|
113 | gui::Tab *GetPlotTab(void) const;
|
---|
114 |
|
---|
115 | /*!
|
---|
116 | * \brief Get OneAxisRotation
|
---|
117 | *
|
---|
118 | * \return fixed rotation of the imu
|
---|
119 | */
|
---|
120 | core::OneAxisRotation *GetOneAxisRotation(void) const;
|
---|
121 |
|
---|
122 |
|
---|
123 | protected:
|
---|
124 | /*!
|
---|
125 | * \brief Setup GroupBox
|
---|
126 | *
|
---|
127 | * \return setup GroupBox
|
---|
128 | */
|
---|
129 | gui::GroupBox *GetGroupBox(void) const;
|
---|
130 |
|
---|
131 | /*!
|
---|
132 | * \brief ApplyRotation
|
---|
133 | *
|
---|
134 | * The reimplemented class must call this function to rotate IMU datas, before filling the ImuData. \n
|
---|
135 | * It handles the data rotation if it was defined.
|
---|
136 | *
|
---|
137 | * \param vector vector to apply rotation to
|
---|
138 | */
|
---|
139 | void ApplyRotation(core::Vector3Df& vector);
|
---|
140 |
|
---|
141 | /*!
|
---|
142 | * \brief ApplyRotation
|
---|
143 | *
|
---|
144 | * The reimplemented class must call this function to rotate IMU datas, before filling the ImuData. \n
|
---|
145 | * It handles the data rotation if it was defined.
|
---|
146 | *
|
---|
147 | * \param quaternion quaternion to apply rotation to
|
---|
148 | */
|
---|
149 | void ApplyRotation(core::Quaternion& quaternion);
|
---|
150 |
|
---|
151 | /*!
|
---|
152 | * \brief Get imu datas
|
---|
153 | *
|
---|
154 | * Can be used by dervied class to fill core::ImuData
|
---|
155 | *
|
---|
156 | * \param imuData imu datas
|
---|
157 | */
|
---|
158 | void GetDatas(core::ImuData **imuData) const;
|
---|
159 |
|
---|
160 | private:
|
---|
161 | gui::Tab *mainTab, *sensorTab, *plotTab;
|
---|
162 | gui::TabWidget *tab;
|
---|
163 | gui::GroupBox *setupGroupbox;
|
---|
164 | core::OneAxisRotation *rotation;
|
---|
165 | core::ImuData *imuData;
|
---|
166 |
|
---|
167 | gui::DataPlot1D *axPlot, *ayPlot, *azPlot;
|
---|
168 | gui::DataPlot1D *gxPlot, *gyPlot, *gzPlot;
|
---|
169 | gui::DataPlot1D *mxPlot, *myPlot, *mzPlot;
|
---|
170 | };
|
---|
171 | } // end namespace sensor
|
---|
172 | } // end namespace flair
|
---|
173 |
|
---|
174 | #endif // IMU_H
|
---|