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 PidThrust.h
|
---|
7 | * \brief Class defining a Pid for Thrust
|
---|
8 | * \author Guillaume Sanahuja, Copyright Heudiasyc UMR UTC/CNRS 7253
|
---|
9 | * \date 2014/11/07
|
---|
10 | * \version 4.0
|
---|
11 | */
|
---|
12 |
|
---|
13 | #ifndef PIDTHRUST_H
|
---|
14 | #define PIDTHRUST_H
|
---|
15 |
|
---|
16 | #include <ControlLaw.h>
|
---|
17 |
|
---|
18 | namespace flair {
|
---|
19 | namespace gui {
|
---|
20 | class LayoutPosition;
|
---|
21 | }
|
---|
22 | }
|
---|
23 |
|
---|
24 | class PidThrust_impl;
|
---|
25 |
|
---|
26 | namespace flair {
|
---|
27 | namespace filter {
|
---|
28 | /*! \class PidThrust
|
---|
29 | *
|
---|
30 | * \brief Class defining a Pid for Thrust.\n
|
---|
31 | * This Pid as an extra offset for compensating gravity.
|
---|
32 | */
|
---|
33 | class PidThrust : public ControlLaw {
|
---|
34 | friend class ::PidThrust_impl;
|
---|
35 |
|
---|
36 | public:
|
---|
37 | /*!
|
---|
38 | * \brief Constructor
|
---|
39 | *
|
---|
40 | * Construct a PidThrust at given position
|
---|
41 | * The PidThrust will automatically be child of position->getLayout() Layout.
|
---|
42 | *After calling this function,
|
---|
43 | * position will be deleted as it is no longer usefull. \n
|
---|
44 | *
|
---|
45 | * \param position position to display settings
|
---|
46 | * \param name name
|
---|
47 | */
|
---|
48 | PidThrust(const gui::LayoutPosition *position, std::string name);
|
---|
49 |
|
---|
50 | /*!
|
---|
51 | * \brief Destructor
|
---|
52 | *
|
---|
53 | */
|
---|
54 | ~PidThrust();
|
---|
55 |
|
---|
56 | /*!
|
---|
57 | * \brief Reset the control law
|
---|
58 | * equivalent to:
|
---|
59 | * ResetI();
|
---|
60 | * SetDefaultOffset();
|
---|
61 | * SetValues(0,0);
|
---|
62 | *
|
---|
63 | */
|
---|
64 | void Reset(void);
|
---|
65 |
|
---|
66 | /*!
|
---|
67 | * \brief Reset integral to 0
|
---|
68 | *
|
---|
69 | */
|
---|
70 | void ResetI(void);
|
---|
71 |
|
---|
72 | /*!
|
---|
73 | * \brief Set offset to a specified value
|
---|
74 | *
|
---|
75 | * \param value desired value
|
---|
76 | */
|
---|
77 | void SetOffset(float value);
|
---|
78 |
|
---|
79 | /*!
|
---|
80 | * \brief Set offset to specified value in ground station
|
---|
81 | *
|
---|
82 | */
|
---|
83 | void SetDefaultOffset(void);
|
---|
84 |
|
---|
85 | /*!
|
---|
86 | * \brief Get offset
|
---|
87 | *
|
---|
88 | * \return current offset
|
---|
89 | */
|
---|
90 | float GetOffset(void) const;
|
---|
91 |
|
---|
92 | /*!
|
---|
93 | * \brief Get intergral part
|
---|
94 | *
|
---|
95 | * \return current integral part
|
---|
96 | */
|
---|
97 | float GetIntegral(void) const;
|
---|
98 |
|
---|
99 | /*!
|
---|
100 | * \brief Step up the offset according to specified value in ground station
|
---|
101 | *
|
---|
102 | * \return false if offset is at its maximum (1) value, true otherwise
|
---|
103 | */
|
---|
104 | bool OffsetStepUp(void);
|
---|
105 |
|
---|
106 | /*!
|
---|
107 | * \brief Step down the offset according to specified value in ground station
|
---|
108 | *
|
---|
109 | * \return false if offset is at its minimum (specified in ground station)
|
---|
110 | *value, true otherwise
|
---|
111 | */
|
---|
112 | bool OffsetStepDown(void);
|
---|
113 |
|
---|
114 | /*!
|
---|
115 | * \brief Set input values
|
---|
116 | *
|
---|
117 | * \param p proportional value
|
---|
118 | * \param d derivative value
|
---|
119 | */
|
---|
120 | void SetValues(float p, float d);
|
---|
121 |
|
---|
122 | /*!
|
---|
123 | * \brief Use default plot
|
---|
124 | *
|
---|
125 | * Plot the output values at position. \n
|
---|
126 | * Plot consists of 4 curves: proportional part,
|
---|
127 | * derivative part, integral part and
|
---|
128 | * the sum of the three. \n
|
---|
129 | * After calling this function, position will be deleted as it is no longer
|
---|
130 | *usefull. \n
|
---|
131 | *
|
---|
132 | * \param position position to display plot
|
---|
133 | */
|
---|
134 | void UseDefaultPlot(const gui::LayoutPosition *position);
|
---|
135 |
|
---|
136 | private:
|
---|
137 | /*!
|
---|
138 | * \brief Update using provided datas
|
---|
139 | *
|
---|
140 | * Reimplemented from IODevice.
|
---|
141 | *
|
---|
142 | * \param data data from the parent to process
|
---|
143 | */
|
---|
144 | void UpdateFrom(const core::io_data *data);
|
---|
145 |
|
---|
146 | PidThrust_impl *pimpl_;
|
---|
147 | };
|
---|
148 | } // end namespace filter
|
---|
149 | } // end namespace flair
|
---|
150 | #endif // PIDTHRUST_H
|
---|