PID Control 1.0
Discrete time implementation of P, PI, PD, PID. Including derivative filter, integral clamping, feed-forward, gain scheduling in standard and parallel form.
Loading...
Searching...
No Matches
p.tpp
Go to the documentation of this file.
2
3template <typename T>
5{
6 Kp = 0.0;
7}
8
9template <typename T>
11{
12 set_param(Kp_, u_max_);
13}
14
15template <typename T>
17{
18 Kp = Kp_;
19 u_max = u_max_;
20}
21
22template <typename T>
24{
25 return saturate(Kp * (x_0 - x), -u_max, u_max);
26}
27
28template <typename T>
30{
31}
32
33template <typename T>
35{
36 Kp = Kp_;
37}
38
39template <typename T>
41{
42 u_max = u_max_;
43}
44
45template <typename T>
47{
48 return Kp;
49}
50
51template <typename T>
53{
54 return u_max;
55}
void init(T Kp_, T u_max_)
Initializes the proportional controller.
Definition p.h:11
P()
Constructs a proportional controller.
Definition p.h:5
void set_u_max(T u_max_)
Sets the maximum controller output.
Definition p.h:41
T update(T x_0, T x)
Computes the proportional control output.
Definition p.h:24
T get_Kp()
Gets the proportional gain.
Definition p.h:47
void set_param(T Kp_, T u_max_)
Sets the controller parameters.
Definition p.h:17
T get_u_max()
Gets the maximum controller output.
Definition p.h:53
void reset()
Resets the controller.
Definition p.h:30
void set_Kp(T Kp_)
Sets the proportional gain.
Definition p.h:35
Proportional (P) controller.
constexpr T saturate(T x, T x_min, T x_max)
Saturates a value within a specified range.
Definition utility.h:51