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 Pid.h |
---|
7 | * \brief Class defining a PID |
---|
8 | * \author Guillaume Sanahuja, Copyright Heudiasyc UMR UTC/CNRS 7253 |
---|
9 | * \date 2011/05/01 |
---|
10 | * \version 4.0 |
---|
11 | */ |
---|
12 | |
---|
13 | #ifndef PID_H |
---|
14 | #define PID_H |
---|
15 | |
---|
16 | #include <ControlLaw.h> |
---|
17 | |
---|
18 | namespace flair { |
---|
19 | namespace gui { |
---|
20 | class LayoutPosition; |
---|
21 | } |
---|
22 | } |
---|
23 | |
---|
24 | class Pid_impl; |
---|
25 | |
---|
26 | namespace flair { |
---|
27 | namespace filter { |
---|
28 | /*! \class Pid |
---|
29 | * |
---|
30 | * \brief Class defining a PID |
---|
31 | */ |
---|
32 | class Pid : public ControlLaw { |
---|
33 | friend class ::Pid_impl; |
---|
34 | |
---|
35 | public: |
---|
36 | /*! |
---|
37 | * \brief Constructor |
---|
38 | * |
---|
39 | * Construct a PID at given position. \n |
---|
40 | * The PID will automatically be child of position->getLayout() Layout. After |
---|
41 | *calling this function, |
---|
42 | * position will be deleted as it is no longer usefull. \n |
---|
43 | * |
---|
44 | * \param position position to display settings |
---|
45 | * \param name name |
---|
46 | */ |
---|
47 | Pid(const gui::LayoutPosition *position, std::string name); |
---|
48 | |
---|
49 | /*! |
---|
50 | * \brief Destructor |
---|
51 | * |
---|
52 | */ |
---|
53 | ~Pid(); |
---|
54 | |
---|
55 | /*! |
---|
56 | * \brief Reset integral |
---|
57 | * |
---|
58 | */ |
---|
59 | void Reset(void); |
---|
60 | |
---|
61 | /*! |
---|
62 | * \brief Get intergral part |
---|
63 | * |
---|
64 | * \return current integral part |
---|
65 | */ |
---|
66 | float GetIntegral(void) const; |
---|
67 | |
---|
68 | |
---|
69 | /*! |
---|
70 | * \brief Set input values |
---|
71 | * |
---|
72 | * \param p proportional value |
---|
73 | * \param d derivative value |
---|
74 | */ |
---|
75 | void SetValues(float p, float d); |
---|
76 | |
---|
77 | /*! |
---|
78 | * \brief Use default plot |
---|
79 | * |
---|
80 | * Plot the output values at position. \n |
---|
81 | * Plot consists of 4 curves: proportional part, |
---|
82 | * derivative part, integral part and |
---|
83 | * the sum of the three. \n |
---|
84 | * After calling this function, position will be deleted as it is no longer |
---|
85 | *usefull. \n |
---|
86 | * |
---|
87 | * \param position position to display plot |
---|
88 | */ |
---|
89 | void UseDefaultPlot(const gui::LayoutPosition *position); |
---|
90 | |
---|
91 | private: |
---|
92 | /*! |
---|
93 | * \brief Update using provided datas |
---|
94 | * |
---|
95 | * Reimplemented from IODevice. |
---|
96 | * |
---|
97 | * \param data data from the parent to process |
---|
98 | */ |
---|
99 | void UpdateFrom(const core::io_data *data); |
---|
100 | |
---|
101 | Pid_impl *pimpl_; |
---|
102 | }; |
---|
103 | } // end namespace filter |
---|
104 | } // end namespace flair |
---|
105 | #endif // PID_H |
---|