[7] | 1 | /*!
|
---|
| 2 | * \file UavMultiplex.h
|
---|
| 3 | * \brief Class defining uav multiplexing
|
---|
| 4 | * \author Guillaume Sanahuja, Copyright Heudiasyc UMR UTC/CNRS 7253
|
---|
| 5 | * \date 2014/04/11
|
---|
| 6 | * \version 4.0
|
---|
| 7 | */
|
---|
| 8 |
|
---|
| 9 | #ifndef UAVMULTIPLEX_H
|
---|
| 10 | #define UAVMULTIPLEX_H
|
---|
| 11 |
|
---|
| 12 | #include <IODevice.h>
|
---|
| 13 | #include <stdint.h>
|
---|
| 14 |
|
---|
| 15 | namespace flair
|
---|
| 16 | {
|
---|
| 17 | namespace core
|
---|
| 18 | {
|
---|
| 19 | class FrameworkManager;
|
---|
| 20 | class io_data;
|
---|
| 21 | }
|
---|
| 22 | namespace gui
|
---|
| 23 | {
|
---|
| 24 | class TabWidget;
|
---|
| 25 | class Layout;
|
---|
| 26 | }
|
---|
| 27 | }
|
---|
| 28 |
|
---|
| 29 | class UavMultiplex_impl;
|
---|
| 30 |
|
---|
| 31 | namespace flair
|
---|
| 32 | {
|
---|
| 33 | namespace filter
|
---|
| 34 | {
|
---|
| 35 | /*! \class UavMultiplex
|
---|
| 36 | *
|
---|
| 37 | * \brief Class defining uav multiplexing
|
---|
| 38 | */
|
---|
| 39 | class UavMultiplex : public core::IODevice
|
---|
| 40 | {
|
---|
| 41 | public:
|
---|
| 42 | /*!
|
---|
| 43 | * \brief Constructor
|
---|
| 44 | *
|
---|
| 45 | * Construct a uav multiplexing
|
---|
| 46 | *
|
---|
| 47 | * \param parent parent
|
---|
| 48 | * \param name name
|
---|
| 49 | */
|
---|
| 50 | UavMultiplex(const core::FrameworkManager* parent,std::string name);
|
---|
| 51 |
|
---|
| 52 | /*!
|
---|
| 53 | * \brief Destructor
|
---|
| 54 | *
|
---|
| 55 | */
|
---|
| 56 | ~UavMultiplex();
|
---|
| 57 |
|
---|
| 58 | /*!
|
---|
| 59 | * \brief Set roll torque
|
---|
| 60 | *
|
---|
| 61 | * roll torque is placed in input(0,0)
|
---|
| 62 | *
|
---|
| 63 | * \param value value between -1 and 1
|
---|
| 64 | */
|
---|
| 65 | void SetRoll(float value);
|
---|
| 66 |
|
---|
| 67 | /*!
|
---|
| 68 | * \brief Set pitch torque
|
---|
| 69 | *
|
---|
| 70 | * pitch torque is placed in input(1,0)
|
---|
| 71 | *
|
---|
| 72 | * \param value value between -1 and 1
|
---|
| 73 | */
|
---|
| 74 | void SetPitch(float value);
|
---|
| 75 |
|
---|
| 76 | /*!
|
---|
| 77 | * \brief Set yaw torque
|
---|
| 78 | *
|
---|
| 79 | * yaw torque is placed in input(2,0)
|
---|
| 80 | *
|
---|
| 81 | * \param value value between -1 and 1
|
---|
| 82 | */
|
---|
| 83 | void SetYaw(float value);
|
---|
| 84 |
|
---|
| 85 | /*!
|
---|
| 86 | * \brief Set thrust
|
---|
| 87 | *
|
---|
| 88 | * thrust is placed in input(3,0)
|
---|
| 89 | *
|
---|
| 90 | * \param value value between 0 and 1
|
---|
| 91 | */
|
---|
| 92 | void SetThrust(float value);
|
---|
| 93 |
|
---|
| 94 | /*!
|
---|
| 95 | * \brief Set roll trim
|
---|
| 96 | *
|
---|
| 97 | * trim is placed in input(4,0)
|
---|
| 98 | *
|
---|
| 99 | * \param value value
|
---|
| 100 | */
|
---|
| 101 | void SetRollTrim(float value);
|
---|
| 102 |
|
---|
| 103 | /*!
|
---|
| 104 | * \brief Set pitch trim
|
---|
| 105 | *
|
---|
| 106 | * trim is placed in input(5,0)
|
---|
| 107 | *
|
---|
| 108 | * \param value value
|
---|
| 109 | */
|
---|
| 110 | void SetPitchTrim(float value);
|
---|
| 111 |
|
---|
| 112 | /*!
|
---|
| 113 | * \brief Set yaw trim
|
---|
| 114 | *
|
---|
| 115 | * trim is placed in input(6,0)
|
---|
| 116 | *
|
---|
| 117 | * \param value value
|
---|
| 118 | */
|
---|
| 119 | void SetYawTrim(float value);
|
---|
| 120 |
|
---|
| 121 | /*!
|
---|
| 122 | * \brief Update using provided datas
|
---|
| 123 | *
|
---|
| 124 | * Uses values specified by Set*().
|
---|
| 125 | *
|
---|
| 126 | * \param time time of the update
|
---|
| 127 | */
|
---|
| 128 | void Update(core::Time time);
|
---|
| 129 |
|
---|
| 130 | /*!
|
---|
| 131 | * \brief Lock user interface
|
---|
| 132 | *
|
---|
| 133 | * User interface will be grayed out.\n
|
---|
| 134 | * Use it do disallow changes when flying.
|
---|
| 135 | *
|
---|
| 136 | */
|
---|
| 137 | void LockUserInterface(void) const;
|
---|
| 138 |
|
---|
| 139 | /*!
|
---|
| 140 | * \brief Unlock user interface
|
---|
| 141 | *
|
---|
| 142 | * User interface will be enabled.\n
|
---|
| 143 | *
|
---|
| 144 | */
|
---|
| 145 | void UnlockUserInterface(void) const;
|
---|
| 146 |
|
---|
| 147 | /*!
|
---|
| 148 | * \brief Layout
|
---|
| 149 | *
|
---|
| 150 | * Layout to place custom widgets.\n
|
---|
| 151 | *
|
---|
| 152 | * \return the layout
|
---|
| 153 | */
|
---|
| 154 | gui::Layout* GetLayout(void) const;
|
---|
| 155 |
|
---|
| 156 | /*!
|
---|
| 157 | * \brief Use default plot
|
---|
| 158 | *
|
---|
| 159 | * Derived class can implement this function do draw default plot.
|
---|
| 160 | *
|
---|
| 161 | */
|
---|
| 162 | virtual void UseDefaultPlot(void){};
|
---|
| 163 |
|
---|
| 164 | /*!
|
---|
| 165 | * \brief Motors count
|
---|
| 166 | *
|
---|
| 167 | * This function must be reimplemented, in order to get the number of motors.
|
---|
| 168 | *
|
---|
| 169 | * \return motors count
|
---|
| 170 | */
|
---|
| 171 | virtual uint8_t MotorsCount(void) const=0;
|
---|
| 172 |
|
---|
| 173 | /*!
|
---|
| 174 | * \brief Multiplex value
|
---|
| 175 | *
|
---|
| 176 | * Get the mutliplexed value of a motor, if SetMultiplexComboBox() was used.\n
|
---|
| 177 | *
|
---|
| 178 | * \param index index of the motor, from 0 to MotorsCount()
|
---|
| 179 | * \return multiplexed index of the motor
|
---|
| 180 | */
|
---|
| 181 | int MultiplexValue(int index) const;
|
---|
| 182 |
|
---|
| 183 | /*!
|
---|
| 184 | * \brief Get TabWidget
|
---|
| 185 | *
|
---|
| 186 | * Usefull to add tabs.\n
|
---|
| 187 | *
|
---|
| 188 | * \return the TabWidget
|
---|
| 189 | */
|
---|
| 190 | gui::TabWidget* GetTabWidget(void) const;
|
---|
| 191 |
|
---|
| 192 | protected:
|
---|
| 193 | /*!
|
---|
| 194 | * \brief Set multiplex ComboBox
|
---|
| 195 | *
|
---|
| 196 | * Draws a ComboBox to define motor multiplexing. \n
|
---|
| 197 | * This is used to change the order of the output motors.
|
---|
| 198 | *
|
---|
| 199 | * \param name description of the motor (ex front left)
|
---|
| 200 | * \param index index of the motor, from 0 to MotorsCount()
|
---|
| 201 | */
|
---|
| 202 | void SetMultiplexComboBox(std::string name,int index);
|
---|
| 203 |
|
---|
| 204 | private:
|
---|
| 205 | /*!
|
---|
| 206 | * \brief Update using provided datas
|
---|
| 207 | *
|
---|
| 208 | * This function is automatically called by ProcessUpdate()
|
---|
| 209 | * of the Object::Parent's if its Object::ObjectType is "IODevice". \n
|
---|
| 210 | * This function must be reimplemented, in order to process the data from the parent.
|
---|
| 211 | *
|
---|
| 212 | * \param data data from the parent to process
|
---|
| 213 | */
|
---|
| 214 | virtual void UpdateFrom(const core::io_data *data)=0;
|
---|
| 215 |
|
---|
| 216 | UavMultiplex_impl *pimpl_;
|
---|
| 217 | };
|
---|
| 218 | } // end namespace filter
|
---|
| 219 | } // end namespace flair
|
---|
| 220 | #endif // UAVMULTIPLEX_H
|
---|