[10] | 1 | // %flair:license{
|
---|
[15] | 2 | // This file is part of the Flair framework distributed under the
|
---|
| 3 | // CECILL-C License, Version 1.0.
|
---|
[10] | 4 | // %flair:license}
|
---|
[7] | 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 |
|
---|
[15] | 19 | namespace flair {
|
---|
| 20 | namespace core {
|
---|
| 21 | class Quaternion;
|
---|
| 22 | class AhrsData;
|
---|
[7] | 23 | }
|
---|
[15] | 24 | namespace gui {
|
---|
| 25 | class LayoutPosition;
|
---|
| 26 | }
|
---|
| 27 | }
|
---|
[7] | 28 |
|
---|
| 29 | class JoyReference_impl;
|
---|
| 30 |
|
---|
[15] | 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);
|
---|
[7] | 53 |
|
---|
[15] | 54 | /*!
|
---|
| 55 | * \brief Destructor
|
---|
| 56 | *
|
---|
| 57 | */
|
---|
| 58 | ~JoyReference();
|
---|
[7] | 59 |
|
---|
[15] | 60 | /*!
|
---|
| 61 | * \brief Set roll axis value
|
---|
| 62 | *
|
---|
| 63 | * \param value value
|
---|
| 64 | */
|
---|
| 65 | void SetRollAxis(float value);
|
---|
[7] | 66 |
|
---|
[15] | 67 | /*!
|
---|
| 68 | * \brief Set pitch axis value
|
---|
| 69 | *
|
---|
| 70 | * \param value value
|
---|
| 71 | */
|
---|
| 72 | void SetPitchAxis(float value);
|
---|
[7] | 73 |
|
---|
[15] | 74 | /*!
|
---|
| 75 | * \brief Set yaw axis value
|
---|
| 76 | *
|
---|
| 77 | * \param value value
|
---|
| 78 | */
|
---|
| 79 | void SetYawAxis(float value);
|
---|
[7] | 80 |
|
---|
[15] | 81 | /*!
|
---|
| 82 | * \brief Set thrust axis value
|
---|
| 83 | *
|
---|
| 84 | * \param value value
|
---|
| 85 | */
|
---|
| 86 | void SetAltitudeAxis(float value);
|
---|
[7] | 87 |
|
---|
[15] | 88 | /*!
|
---|
| 89 | * \brief Get orientation reference
|
---|
| 90 | *
|
---|
| 91 | * \return reference
|
---|
| 92 | */
|
---|
| 93 | core::AhrsData *GetReferenceOrientation(void) const;
|
---|
[7] | 94 |
|
---|
[15] | 95 | /*!
|
---|
| 96 | * \brief Get z reference
|
---|
| 97 | *
|
---|
| 98 | * \return reference
|
---|
| 99 | */
|
---|
| 100 | float ZRef(void) const;
|
---|
[7] | 101 |
|
---|
[15] | 102 | /*!
|
---|
| 103 | * \brief Get z derivative reference
|
---|
| 104 | *
|
---|
| 105 | * \return reference
|
---|
| 106 | */
|
---|
| 107 | float DzRef(void) const;
|
---|
[7] | 108 |
|
---|
[15] | 109 | /*!
|
---|
| 110 | * \brief Get roll trim
|
---|
| 111 | *
|
---|
| 112 | * \return trim value
|
---|
| 113 | */
|
---|
| 114 | float RollTrim(void) const;
|
---|
[7] | 115 |
|
---|
[15] | 116 | /*!
|
---|
| 117 | * \brief Get pitch trim
|
---|
| 118 | *
|
---|
| 119 | * \return trim value
|
---|
| 120 | */
|
---|
| 121 | float PitchTrim(void) const;
|
---|
[7] | 122 |
|
---|
[15] | 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);
|
---|
[7] | 133 |
|
---|
[15] | 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);
|
---|
[7] | 144 |
|
---|
[15] | 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);
|
---|
[7] | 155 |
|
---|
[15] | 156 | /*!
|
---|
| 157 | * \brief Trim up roll
|
---|
| 158 | *
|
---|
| 159 | * Roll trim value is increased by one
|
---|
| 160 | */
|
---|
| 161 | void RollTrimUp(void);
|
---|
[7] | 162 |
|
---|
[15] | 163 | /*!
|
---|
| 164 | * \brief Trim down roll
|
---|
| 165 | *
|
---|
| 166 | * Roll trim value is decreased by one
|
---|
| 167 | */
|
---|
| 168 | void RollTrimDown(void);
|
---|
[7] | 169 |
|
---|
[15] | 170 | /*!
|
---|
| 171 | * \brief Trim up pitch
|
---|
| 172 | *
|
---|
| 173 | * Pitch trim value is increased by one
|
---|
| 174 | */
|
---|
| 175 | void PitchTrimUp(void);
|
---|
[7] | 176 |
|
---|
[15] | 177 | /*!
|
---|
| 178 | * \brief Trim down pitch
|
---|
| 179 | *
|
---|
| 180 | * Pitch trim value is decreased by one
|
---|
| 181 | */
|
---|
| 182 | void PitchTrimDown(void);
|
---|
[7] | 183 |
|
---|
[15] | 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);
|
---|
[7] | 192 |
|
---|
[15] | 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);
|
---|
[7] | 202 |
|
---|
[15] | 203 | class JoyReference_impl *pimpl_;
|
---|
| 204 | };
|
---|
[7] | 205 | } // end namespace sensor
|
---|
| 206 | } // end namespace flair
|
---|
| 207 |
|
---|
| 208 | #endif // JOYREFERENCE_H
|
---|