source: flair-src/trunk/lib/FlairFilter/src/UavMultiplex.h@ 268

Last change on this file since 268 was 137, checked in by Sanahuja Guillaume, 7 years ago

singleton manager

File size: 4.1 KB
Line 
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}
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
19namespace flair {
20namespace core {
21class io_data;
22}
23namespace gui {
24class TabWidget;
25class Layout;
26}
27}
28
29class UavMultiplex_impl;
30
31namespace flair {
32namespace filter {
33/*! \class UavMultiplex
34*
35* \brief Class defining uav multiplexing
36*/
37class UavMultiplex : public core::IODevice {
38public:
39 /*!
40 * \brief Constructor
41 *
42 * Construct a uav multiplexing. It will be child of the FrameworkManager.
43 *
44 * \param name name
45 */
46 UavMultiplex(std::string name);
47
48 /*!
49 * \brief Destructor
50 *
51 */
52 ~UavMultiplex();
53
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);
62
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);
71
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);
80
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);
89
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);
98
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);
107
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);
116
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);
125
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;
134
135 /*!
136 * \brief Unlock user interface
137 *
138 * User interface will be enabled.\n
139 *
140 */
141 void UnlockUserInterface(void) const;
142
143 /*!
144 * \brief Layout
145 *
146 * Layout to place custom widgets.\n
147 *
148 * \return the layout
149 */
150 gui::Layout *GetLayout(void) const;
151
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){};
159
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;
168
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;
178
179 /*!
180 * \brief Get TabWidget
181 *
182 * Usefull to add tabs.\n
183 *
184 * \return the TabWidget
185 */
186 gui::TabWidget *GetTabWidget(void) const;
187
188protected:
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);
199
200private:
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;
212
213 UavMultiplex_impl *pimpl_;
214};
215} // end namespace filter
216} // end namespace flair
217#endif // UAVMULTIPLEX_H
Note: See TracBrowser for help on using the repository browser.