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 | // created: 2013/04/29
|
---|
6 | // filename: BlCtrlV2_x4_speed.cpp
|
---|
7 | //
|
---|
8 | // author: Guillaume Sanahuja
|
---|
9 | // Copyright Heudiasyc UMR UTC/CNRS 7253
|
---|
10 | //
|
---|
11 | // version: $Id: $
|
---|
12 | //
|
---|
13 | // purpose: objet integrant les moteurs i2c, controle en vitesse
|
---|
14 | //
|
---|
15 | //
|
---|
16 | /*********************************************************************/
|
---|
17 |
|
---|
18 | #ifndef BLCTRLV2_X4_SPEED_H
|
---|
19 | #define BLCTRLV2_X4_SPEED_H
|
---|
20 |
|
---|
21 | #include <IODevice.h>
|
---|
22 | #include <Thread.h>
|
---|
23 |
|
---|
24 | namespace flair {
|
---|
25 | namespace core {
|
---|
26 | class Matrix;
|
---|
27 | class I2cPort;
|
---|
28 | }
|
---|
29 | namespace gui {
|
---|
30 | class TabWidget;
|
---|
31 | class Tab;
|
---|
32 | class SpinBox;
|
---|
33 | class DoubleSpinBox;
|
---|
34 | class ComboBox;
|
---|
35 | class PushButton;
|
---|
36 | class GroupBox;
|
---|
37 | }
|
---|
38 | }
|
---|
39 |
|
---|
40 | namespace flair {
|
---|
41 | namespace actuator {
|
---|
42 | class BlCtrlV2_x4_speed : public core::Thread, public core::IODevice {
|
---|
43 |
|
---|
44 | public:
|
---|
45 | BlCtrlV2_x4_speed(std::string name,
|
---|
46 | core::I2cPort *i2cport, uint8_t base_address,
|
---|
47 | uint8_t priority);
|
---|
48 | ~BlCtrlV2_x4_speed();
|
---|
49 | void UseDefaultPlot(void);
|
---|
50 | void LockUserInterface(void);
|
---|
51 | void UnlockUserInterface(void);
|
---|
52 | void SetEnabled(bool status);
|
---|
53 | void SetUroll(float value);
|
---|
54 | void SetUpitch(float value);
|
---|
55 | void SetUyaw(float value);
|
---|
56 | void SetUgaz(float value);
|
---|
57 | void SetRollTrim(float value);
|
---|
58 | void SetPitchTrim(float value);
|
---|
59 | void SetYawTrim(float value);
|
---|
60 | void SetGazTrim(float value);
|
---|
61 | float TrimValue(void);
|
---|
62 | int StartValue(void);
|
---|
63 |
|
---|
64 | private:
|
---|
65 | /*!
|
---|
66 | * \brief Update using provided datas
|
---|
67 | *
|
---|
68 | * Reimplemented from IODevice.
|
---|
69 | *
|
---|
70 | * \param data data from the parent to process
|
---|
71 | */
|
---|
72 | void UpdateFrom(core::io_data *data){};
|
---|
73 | void WriteValue(uint16_t value);
|
---|
74 | float GetSpeed(void);
|
---|
75 | void StartTest(void);
|
---|
76 | void StopTest(void);
|
---|
77 | /*!
|
---|
78 | * \brief Run function
|
---|
79 | *
|
---|
80 | * Reimplemented from Thread.
|
---|
81 | *
|
---|
82 | */
|
---|
83 | void Run(void);
|
---|
84 | void Update(void);
|
---|
85 | gui::Tab *main_tab;
|
---|
86 | gui::TabWidget *tab;
|
---|
87 | gui::GroupBox *reglages_groupbox;
|
---|
88 | gui::SpinBox *min, *max, *test;
|
---|
89 | gui::PushButton *button_avg, *button_avd, *button_arg, *button_ard;
|
---|
90 | gui::ComboBox *av_g, *av_d, *ar_g, *ar_d, *pas;
|
---|
91 | gui::DoubleSpinBox *trim, *kp, *ki;
|
---|
92 | gui::SpinBox *start_value, *poles;
|
---|
93 | core::Time start_time, flight_start_time;
|
---|
94 | int time_sec;
|
---|
95 | float speed_av_g, speed_av_d, speed_ar_g, speed_ar_d;
|
---|
96 | float int_av_g, int_av_d, int_ar_g, int_ar_d;
|
---|
97 |
|
---|
98 | // matrix
|
---|
99 | core::Matrix *input;
|
---|
100 | core::Matrix *output;
|
---|
101 |
|
---|
102 | int tested_motor;
|
---|
103 | core::I2cPort *i2cport;
|
---|
104 | uint8_t slave_address;
|
---|
105 |
|
---|
106 | bool enabled;
|
---|
107 |
|
---|
108 | uint16_t SatPWM(float vel_cons, uint16_t min, uint16_t max);
|
---|
109 | };
|
---|
110 | } // end namespace actuator
|
---|
111 | } // end namespace flair
|
---|
112 | #endif // BLCTRLV2_X4_SPEED_H
|
---|