Class PIDController

java.lang.Object
com.cdarobotics.cdalib.controllers.Controller
com.cdarobotics.cdalib.controllers.PIDController

public class PIDController extends Controller
A proportional-integral-derivative (PID) feedback Controller. The output is the sum of a proportional term on the current error, an integral term accumulated with trapezoidal integration, and a derivative term on the rate of change of error.
  • Constructor Details

    • PIDController

      public PIDController(double target, double kP, double kI, double kD)
      Parameters:
      target - the initial setpoint
      kP - the proportional gain
      kI - the integral gain
      kD - the derivative gain
  • Method Details

    • update

      public double update(double current, double dt)
      Description copied from class: Controller
      Computes the control output for this loop.
      Specified by:
      update in class Controller
      Parameters:
      current - the current measured value
      dt - the time elapsed since the previous update, in seconds
      Returns:
      the control output to apply