5 template<
typename MessageType,
6 typename FloatFieldType,
typename BoolFieldType,
7 typename FloatEnumType,
typename BoolEnumType>
11 #ifndef DOXYGEN_OMIT_INTERNAL 12 Gains(MessageType
internal, FloatEnumType kp_gain, BoolEnumType d_on_error_gain)
13 : internal_(
internal),
14 kp_(
internal, kp_gain),
15 ki_(
internal, static_cast<FloatEnumType>(kp_gain + 1)),
16 kd_(
internal, static_cast<FloatEnumType>(kp_gain + 2)),
17 feed_forward_(
internal, static_cast<FloatEnumType>(kp_gain + 3)),
18 dead_zone_(
internal, static_cast<FloatEnumType>(kp_gain + 4)),
19 i_clamp_(
internal, static_cast<FloatEnumType>(kp_gain + 5)),
20 punch_(
internal, static_cast<FloatEnumType>(kp_gain + 6)),
21 min_target_(
internal, static_cast<FloatEnumType>(kp_gain + 7)),
22 max_target_(
internal, static_cast<FloatEnumType>(kp_gain + 8)),
23 target_lowpass_(
internal, static_cast<FloatEnumType>(kp_gain + 9)),
24 min_output_(
internal, static_cast<FloatEnumType>(kp_gain + 10)),
25 max_output_(
internal, static_cast<FloatEnumType>(kp_gain + 11)),
26 output_lowpass_(
internal, static_cast<FloatEnumType>(kp_gain + 12)),
27 d_on_error_(
internal, d_on_error_gain)
30 #endif // DOXYGEN_OMIT_INTERNAL 38 FloatFieldType&
kP() {
return kp_; }
40 const FloatFieldType&
kP()
const {
return kp_; }
42 FloatFieldType&
kI() {
return ki_; }
44 const FloatFieldType&
kI()
const {
return ki_; }
46 FloatFieldType&
kD() {
return kd_; }
48 const FloatFieldType&
kD()
const {
return kd_; }
52 const FloatFieldType&
feedForward()
const {
return feed_forward_; }
54 FloatFieldType&
deadZone() {
return dead_zone_; }
56 const FloatFieldType&
deadZone()
const {
return dead_zone_; }
58 FloatFieldType&
iClamp() {
return i_clamp_; }
60 const FloatFieldType&
iClamp()
const {
return i_clamp_; }
62 FloatFieldType&
punch() {
return punch_; }
64 const FloatFieldType&
punch()
const {
return punch_; }
68 const FloatFieldType&
minTarget()
const {
return min_target_; }
72 const FloatFieldType&
maxTarget()
const {
return max_target_; }
80 const FloatFieldType&
minOutput()
const {
return min_output_; }
84 const FloatFieldType&
maxOutput()
const {
return max_output_; }
90 BoolFieldType&
dOnError() {
return d_on_error_; }
92 const BoolFieldType&
dOnError()
const {
return d_on_error_; }
95 MessageType
const internal_;
100 FloatFieldType feed_forward_;
101 FloatFieldType dead_zone_;
102 FloatFieldType i_clamp_;
103 FloatFieldType punch_;
104 FloatFieldType min_target_;
105 FloatFieldType max_target_;
106 FloatFieldType target_lowpass_;
107 FloatFieldType min_output_;
108 FloatFieldType max_output_;
109 FloatFieldType output_lowpass_;
110 BoolFieldType d_on_error_;
FloatFieldType & minTarget()
Minimum allowed value for input to the PID controller.
Definition: gains.hpp:66
const FloatFieldType & targetLowpass() const
A simple lowpass filter applied to the target set point; needs to be between 0 and 1...
Definition: gains.hpp:76
const FloatFieldType & maxOutput() const
Output from the PID controller is limited to a maximum of this value.
Definition: gains.hpp:84
const FloatFieldType & kP() const
Proportional PID gain.
Definition: gains.hpp:40
const FloatFieldType & outputLowpass() const
A simple lowpass filter applied to the controller output; needs to be between 0 and 1...
Definition: gains.hpp:88
const FloatFieldType & minTarget() const
Minimum allowed value for input to the PID controller.
Definition: gains.hpp:68
const FloatFieldType & kD() const
Derivative PID gain.
Definition: gains.hpp:48
#define HEBI_DISABLE_COPY_MOVE(Class)
Definition: util.hpp:7
const FloatFieldType & punch() const
Constant offset to the PID output outside of the deadzone; it is added when the error is positive and...
Definition: gains.hpp:64
FloatFieldType & outputLowpass()
A simple lowpass filter applied to the controller output; needs to be between 0 and 1...
Definition: gains.hpp:86
const FloatFieldType & maxTarget() const
Maximum allowed value for input to the PID controller.
Definition: gains.hpp:72
FloatFieldType & maxTarget()
Maximum allowed value for input to the PID controller.
Definition: gains.hpp:70
const FloatFieldType & deadZone() const
Error values within +/- this value from zero are treated as zero (in terms of computed proportional o...
Definition: gains.hpp:56
FloatFieldType & feedForward()
Feed forward term (this term is multiplied by the target and added to the output).
Definition: gains.hpp:50
FloatFieldType & deadZone()
Error values within +/- this value from zero are treated as zero (in terms of computed proportional o...
Definition: gains.hpp:54
FloatFieldType & kP()
Proportional PID gain.
Definition: gains.hpp:38
FloatFieldType & iClamp()
Maximum allowed value for the output of the integral component of the PID loop; the integrated error ...
Definition: gains.hpp:58
const FloatFieldType & feedForward() const
Feed forward term (this term is multiplied by the target and added to the output).
Definition: gains.hpp:52
FloatFieldType & kD()
Derivative PID gain.
Definition: gains.hpp:46
const FloatFieldType & minOutput() const
Output from the PID controller is limited to a minimum of this value.
Definition: gains.hpp:80
BoolFieldType & dOnError()
Controls whether the Kd term uses the "derivative of error" or "derivative of measurement." When the setpoints have step inputs or are noisy, setting this to false can eliminate corresponding spikes or noise in the output.
Definition: gains.hpp:90
FloatFieldType & minOutput()
Output from the PID controller is limited to a minimum of this value.
Definition: gains.hpp:78
const BoolFieldType & dOnError() const
Controls whether the Kd term uses the "derivative of error" or "derivative of measurement." When the setpoints have step inputs or are noisy, setting this to false can eliminate corresponding spikes or noise in the output.
Definition: gains.hpp:92
const FloatFieldType & iClamp() const
Maximum allowed value for the output of the integral component of the PID loop; the integrated error ...
Definition: gains.hpp:60
FloatFieldType & targetLowpass()
A simple lowpass filter applied to the target set point; needs to be between 0 and 1...
Definition: gains.hpp:74
FloatFieldType & kI()
Integral PID gain.
Definition: gains.hpp:42
FloatFieldType & maxOutput()
Output from the PID controller is limited to a maximum of this value.
Definition: gains.hpp:82
FloatFieldType & punch()
Constant offset to the PID output outside of the deadzone; it is added when the error is positive and...
Definition: gains.hpp:62
const FloatFieldType & kI() const
Integral PID gain.
Definition: gains.hpp:44