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
utility.h
Go to the documentation of this file.
1
16
46
47#ifndef CONTROL_SYSTEM_PID_UTILITY_H
48#define CONTROL_SYSTEM_PID_UTILITY_H
49
50template <typename T>
51inline constexpr T saturate(T x, T x_min, T x_max)
52{
53 if (x < x_min)
54 {
55 return x_min;
56 }
57 else if (x > x_max)
58 {
59 return x_max;
60 }
61 else
62 {
63 return x;
64 }
65}
66
67#endif // CONTROL_SYSTEM_PID_UTILITY_H
constexpr T saturate(T x, T x_min, T x_max)
Saturates a value within a specified range.
Definition utility.h:51