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