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