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 | * \param needRotation true will enable post rotation in GCS. Post rotation must be applied manually in reimplemented code
|
---|
56 | */
|
---|
57 | Imu(std::string name,bool needRotation=true);
|
---|
58 |
|
---|
59 | /*!
|
---|
60 | * \brief Constructor
|
---|
61 | *
|
---|
62 | * Construct an Imu. \n
|
---|
63 | * This contructor must only be called for a simulated device.
|
---|
64 | *
|
---|
65 | * \param parent parent
|
---|
66 | * \param name name
|
---|
67 | */
|
---|
68 | Imu(const core::IODevice *parent, std::string name);
|
---|
69 |
|
---|
70 | /*!
|
---|
71 | * \brief Destructor
|
---|
72 | *
|
---|
73 | */
|
---|
74 | ~Imu();
|
---|
75 |
|
---|
76 | /*!
|
---|
77 | * \brief Get IMU datas
|
---|
78 | *
|
---|
79 | * \return ImuData
|
---|
80 | */
|
---|
81 | const core::ImuData *GetDatas(void) const;
|
---|
82 |
|
---|
83 |
|
---|
84 | /*!
|
---|
85 | * \brief Setup Layout
|
---|
86 | *
|
---|
87 | * \return setup Layout
|
---|
88 | */
|
---|
89 | gui::Layout *GetLayout(void) const;
|
---|
90 |
|
---|
91 | /*!
|
---|
92 | * \brief Lock user interface
|
---|
93 | *
|
---|
94 | */
|
---|
95 | void LockUserInterface(void) const;
|
---|
96 |
|
---|
97 | /*!
|
---|
98 | * \brief Unlock user interface
|
---|
99 | *
|
---|
100 | */
|
---|
101 | void UnlockUserInterface(void) const;
|
---|
102 |
|
---|
103 | /*!
|
---|
104 | * \brief Use default plot
|
---|
105 | *
|
---|
106 | */
|
---|
107 | void UseDefaultPlot(void);
|
---|
108 |
|
---|
109 | /*!
|
---|
110 | * \brief Plot tab
|
---|
111 | *
|
---|
112 | * \return plot Tab
|
---|
113 | */
|
---|
114 | gui::Tab *GetPlotTab(void) const;
|
---|
115 |
|
---|
116 | /*!
|
---|
117 | * \brief Get OneAxisRotation
|
---|
118 | *
|
---|
119 | * \return fixed rotation of the imu
|
---|
120 | */
|
---|
121 | core::OneAxisRotation *GetOneAxisRotation(void) const;
|
---|
122 |
|
---|
123 |
|
---|
124 | protected:
|
---|
125 | /*!
|
---|
126 | * \brief Setup GroupBox
|
---|
127 | *
|
---|
128 | * \return setup GroupBox
|
---|
129 | */
|
---|
130 | gui::GroupBox *GetGroupBox(void) const;
|
---|
131 |
|
---|
132 | /*!
|
---|
133 | * \brief ApplyRotation
|
---|
134 | *
|
---|
135 | * The reimplemented class must call this function to rotate IMU datas, before filling the ImuData. \n
|
---|
136 | * It handles the data rotation if it was defined.
|
---|
137 | *
|
---|
138 | * \param vector vector to apply rotation to
|
---|
139 | */
|
---|
140 | void ApplyRotation(core::Vector3Df& vector);
|
---|
141 |
|
---|
142 | /*!
|
---|
143 | * \brief ApplyRotation
|
---|
144 | *
|
---|
145 | * The reimplemented class must call this function to rotate IMU datas, before filling the ImuData. \n
|
---|
146 | * It handles the data rotation if it was defined.
|
---|
147 | *
|
---|
148 | * \param quaternion quaternion to apply rotation to
|
---|
149 | */
|
---|
150 | void ApplyRotation(core::Quaternion& quaternion);
|
---|
151 |
|
---|
152 | /*!
|
---|
153 | * \brief Get imu datas
|
---|
154 | *
|
---|
155 | * Can be used by dervied class to fill core::ImuData
|
---|
156 | *
|
---|
157 | * \param imuData imu datas
|
---|
158 | */
|
---|
159 | void GetDatas(core::ImuData **imuData) const;
|
---|
160 |
|
---|
161 | private:
|
---|
162 | gui::Tab *mainTab, *sensorTab, *plotTab;
|
---|
163 | gui::TabWidget *tab;
|
---|
164 | gui::GroupBox *setupGroupbox;
|
---|
165 | core::OneAxisRotation *rotation;
|
---|
166 | core::ImuData *imuData;
|
---|
167 |
|
---|
168 | gui::DataPlot1D *axPlot, *ayPlot, *azPlot;
|
---|
169 | gui::DataPlot1D *gxPlot, *gyPlot, *gzPlot;
|
---|
170 | gui::DataPlot1D *mxPlot, *myPlot, *mzPlot;
|
---|
171 | };
|
---|
172 | } // end namespace sensor
|
---|
173 | } // end namespace flair
|
---|
174 |
|
---|
175 | #endif // IMU_H
|
---|