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