allwpilib
allwpilib copied to clipboard
[wpimath] Add PIDController::GetTotalError and ProfiledPIDController::GetTotalError
Adds the ability to retrieve the accumulated error from both PIDController and ProfiledPIDController to allow for the user to monitor the outputs of each individual term.
Keep in mind you should avoid the I term. The most common cause of steady-state error is modeled disturbances. Feedforward can compensate for that immediately, whereas pure integral control has to wind up and down. Integral control should only be used for unmodeled/unmodelable disturbances, and even then, it should only integrate the difference between the expected and actual plant state, not the difference between the setpoint and plant state.