PID Control
Basics
// specify coefficients/gains
PIDCoefficients coeffs = new PIDCoefficients(kP, kI, kD);
// create the controller
PIDFController controller = new PIDFController(coeffs);
// specify the setpoint
controller.setTargetPosition(setpoint);
// in each iteration of the control loop
// measure the position or output variable
// apply the correction to the input variable
double correction = controller.update(measuredPosition);// specify coefficients/gains
val coeffs = PIDCoefficients(kP, kI, kD);
// create the controller
val controller = PIDFController(coeffs);
// specify the setpoint
controller.targetPosition = setpoint;
// in each iteration of the control loop
// measure the position or output variable
// apply the correction to the input variable
val correction = controller.update(measuredPosition)Tuning

Last updated