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 JoyReference.h
|
---|
7 | * \brief Class creating references from a joystick
|
---|
8 | * \author Guillaume Sanahuja, Copyright Heudiasyc UMR UTC/CNRS 7253
|
---|
9 | * \date 2012/08/29
|
---|
10 | * \version 4.0
|
---|
11 | */
|
---|
12 |
|
---|
13 | #ifndef JOYREFERENCE_H
|
---|
14 | #define JOYREFERENCE_H
|
---|
15 |
|
---|
16 | #include <IODevice.h>
|
---|
17 | #include <stdint.h>
|
---|
18 |
|
---|
19 | namespace flair {
|
---|
20 | namespace core {
|
---|
21 | class Quaternion;
|
---|
22 | class AhrsData;
|
---|
23 | }
|
---|
24 | namespace gui {
|
---|
25 | class LayoutPosition;
|
---|
26 | }
|
---|
27 | }
|
---|
28 |
|
---|
29 | class JoyReference_impl;
|
---|
30 |
|
---|
31 | namespace flair {
|
---|
32 | namespace filter {
|
---|
33 | /*! \class JoyReference
|
---|
34 | *
|
---|
35 | * \brief Class creating references from a joystick
|
---|
36 | */
|
---|
37 | class JoyReference : public core::IODevice {
|
---|
38 | public:
|
---|
39 | /*!
|
---|
40 | * \brief Constructor
|
---|
41 | *
|
---|
42 | * Construct a JoyReference at given position. \n
|
---|
43 | * The JoyReference will automatically be child of position->getLayout()
|
---|
44 | *Layout. After calling this function,
|
---|
45 | * position will be deleted as it is no longer usefull. \n
|
---|
46 | * JoyReference compute reference in quaternion, wz, altitude and altitude
|
---|
47 | *speed.
|
---|
48 | *
|
---|
49 | * \param position position
|
---|
50 | * \param name name
|
---|
51 | */
|
---|
52 | JoyReference(const gui::LayoutPosition *position, std::string name);
|
---|
53 |
|
---|
54 | /*!
|
---|
55 | * \brief Destructor
|
---|
56 | *
|
---|
57 | */
|
---|
58 | ~JoyReference();
|
---|
59 |
|
---|
60 | /*!
|
---|
61 | * \brief Set roll axis value
|
---|
62 | *
|
---|
63 | * \param value value
|
---|
64 | */
|
---|
65 | void SetRollAxis(float value);
|
---|
66 |
|
---|
67 | /*!
|
---|
68 | * \brief Set pitch axis value
|
---|
69 | *
|
---|
70 | * \param value value
|
---|
71 | */
|
---|
72 | void SetPitchAxis(float value);
|
---|
73 |
|
---|
74 | /*!
|
---|
75 | * \brief Set yaw axis value
|
---|
76 | *
|
---|
77 | * \param value value
|
---|
78 | */
|
---|
79 | void SetYawAxis(float value);
|
---|
80 |
|
---|
81 | /*!
|
---|
82 | * \brief Set thrust axis value
|
---|
83 | *
|
---|
84 | * \param value value
|
---|
85 | */
|
---|
86 | void SetAltitudeAxis(float value);
|
---|
87 |
|
---|
88 | /*!
|
---|
89 | * \brief Get orientation reference
|
---|
90 | *
|
---|
91 | * \return reference
|
---|
92 | */
|
---|
93 | core::AhrsData *GetReferenceOrientation(void) const;
|
---|
94 |
|
---|
95 | /*!
|
---|
96 | * \brief Get z reference
|
---|
97 | *
|
---|
98 | * \return reference
|
---|
99 | */
|
---|
100 | float ZRef(void) const;
|
---|
101 |
|
---|
102 | /*!
|
---|
103 | * \brief Get z derivative reference
|
---|
104 | *
|
---|
105 | * \return reference
|
---|
106 | */
|
---|
107 | float DzRef(void) const;
|
---|
108 |
|
---|
109 | /*!
|
---|
110 | * \brief Get roll trim
|
---|
111 | *
|
---|
112 | * \return trim value
|
---|
113 | */
|
---|
114 | float RollTrim(void) const;
|
---|
115 |
|
---|
116 | /*!
|
---|
117 | * \brief Get pitch trim
|
---|
118 | *
|
---|
119 | * \return trim value
|
---|
120 | */
|
---|
121 | float PitchTrim(void) const;
|
---|
122 |
|
---|
123 | /*!
|
---|
124 | * \brief Set yaw reference
|
---|
125 | *
|
---|
126 | * Yaw part of the output quaternion is obtained by integrating the wz desired
|
---|
127 | *angular speed.\n
|
---|
128 | * This method reset the yaw.
|
---|
129 | *
|
---|
130 | * \param value value
|
---|
131 | */
|
---|
132 | void SetYawRef(float value);
|
---|
133 |
|
---|
134 | /*!
|
---|
135 | * \brief Set yaw reference
|
---|
136 | *
|
---|
137 | * Yaw part of the output quaternion is obtained by integrating the wz desired
|
---|
138 | *angular speed.\n
|
---|
139 | * This method reset the yaw.
|
---|
140 | *
|
---|
141 | * \param value value, only the yaw part of the quaternion is used
|
---|
142 | */
|
---|
143 | void SetYawRef(core::Quaternion const &value);
|
---|
144 |
|
---|
145 | /*!
|
---|
146 | * \brief Set z reference
|
---|
147 | *
|
---|
148 | * Altitude of the output is obtained by integrating the vz desired altitude
|
---|
149 | *speed.\n
|
---|
150 | * This method reset z.
|
---|
151 | *
|
---|
152 | * \param value value
|
---|
153 | */
|
---|
154 | void SetZRef(float value);
|
---|
155 |
|
---|
156 | /*!
|
---|
157 | * \brief Trim up roll
|
---|
158 | *
|
---|
159 | * Roll trim value is increased by one
|
---|
160 | */
|
---|
161 | void RollTrimUp(void);
|
---|
162 |
|
---|
163 | /*!
|
---|
164 | * \brief Trim down roll
|
---|
165 | *
|
---|
166 | * Roll trim value is decreased by one
|
---|
167 | */
|
---|
168 | void RollTrimDown(void);
|
---|
169 |
|
---|
170 | /*!
|
---|
171 | * \brief Trim up pitch
|
---|
172 | *
|
---|
173 | * Pitch trim value is increased by one
|
---|
174 | */
|
---|
175 | void PitchTrimUp(void);
|
---|
176 |
|
---|
177 | /*!
|
---|
178 | * \brief Trim down pitch
|
---|
179 | *
|
---|
180 | * Pitch trim value is decreased by one
|
---|
181 | */
|
---|
182 | void PitchTrimDown(void);
|
---|
183 |
|
---|
184 | /*!
|
---|
185 | * \brief Update references
|
---|
186 | *
|
---|
187 | * Calls UpdateFrom with values entered manually.
|
---|
188 | *
|
---|
189 | * \param time time
|
---|
190 | */
|
---|
191 | void Update(core::Time time);
|
---|
192 |
|
---|
193 | private:
|
---|
194 | /*!
|
---|
195 | * \brief Update using provided datas
|
---|
196 | *
|
---|
197 | * Reimplemented from IODevice.
|
---|
198 | *
|
---|
199 | * \param data data from the parent to process
|
---|
200 | */
|
---|
201 | void UpdateFrom(const core::io_data *data);
|
---|
202 |
|
---|
203 | class JoyReference_impl *pimpl_;
|
---|
204 | };
|
---|
205 | } // end namespace sensor
|
---|
206 | } // end namespace flair
|
---|
207 |
|
---|
208 | #endif // JOYREFERENCE_H
|
---|