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