Changeset 15 in flair-src for trunk/lib/FlairFilter/src/UavMultiplex.h
- Timestamp:
- 04/08/16 15:40:57 (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/lib/FlairFilter/src/UavMultiplex.h
r10 r15 17 17 #include <stdint.h> 18 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 } 19 namespace flair { 20 namespace core { 21 class FrameworkManager; 22 class io_data; 31 23 } 24 namespace gui { 25 class TabWidget; 26 class Layout; 27 } 28 } 32 29 33 30 class UavMultiplex_impl; 34 31 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 }; 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); 49 50 /*! 51 * \brief Destructor 52 * 53 */ 54 ~UavMultiplex(); 55 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); 64 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); 73 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); 82 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); 91 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); 100 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); 109 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); 118 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); 127 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; 136 137 /*! 138 * \brief Unlock user interface 139 * 140 * User interface will be enabled.\n 141 * 142 */ 143 void UnlockUserInterface(void) const; 144 145 /*! 146 * \brief Layout 147 * 148 * Layout to place custom widgets.\n 149 * 150 * \return the layout 151 */ 152 gui::Layout *GetLayout(void) const; 153 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){}; 161 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; 170 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; 180 181 /*! 182 * \brief Get TabWidget 183 * 184 * Usefull to add tabs.\n 185 * 186 * \return the TabWidget 187 */ 188 gui::TabWidget *GetTabWidget(void) const; 189 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); 201 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; 214 215 UavMultiplex_impl *pimpl_; 216 }; 222 217 } // end namespace filter 223 218 } // end namespace flair
Note:
See TracChangeset
for help on using the changeset viewer.