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