Class PID
Defined in File pid.h
Class Documentation
-
class PID
Public Functions
-
PID(double p, double i, double d, double i_max, double i_min)
Constructor.
- Parameters:
p – proportional gain
i – integral gain
d – derivative gain
i_max – integral wind-up max value
i_min – integral wind-up min value
-
PID()
Constructor. Starts all gains and limits at zero.
initialize gain settings from ROS parameter values
-
void reset()
Reset integral wind-up term.
-
double update(double error, double dt)
Run PID calculation and return control result.
PID derivate term is calculated from change in error value and dt
- Parameters:
error – error term (goal-actual)
dt – timestep used for calculating derivative term and integral windup
- Returns:
calculated PID command
Protected Functions
-
bool checkGains()
Checks and fixes gain settings.
- Returns:
true is gains are ok, false if gains are invalid
Protected Attributes
-
double p_gain_
proportial gain
-
double i_gain_
integral gain
-
double d_gain_
derivative gain
-
double i_max_
integral gain min and max limits
-
double i_min_
-
double i_term_
integral wind-up term
-
double error_last_
Last error value, used for calculating error_dot when not provided.
-
rclcpp::Node::SharedPtr node_
-
PID(double p, double i, double d, double i_max, double i_min)