Class PIDController
java.lang.Object
com.cdarobotics.cdalib.controllers.Controller
com.cdarobotics.cdalib.controllers.PIDController
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.-
Field Summary
Fields inherited from class com.cdarobotics.cdalib.controllers.Controller
target -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondoubleupdate(double current, double dt) Computes the control output for this loop.Methods inherited from class com.cdarobotics.cdalib.controllers.Controller
getTarget, setTarget
-
Constructor Details
-
PIDController
public PIDController(double target, double kP, double kI, double kD) - Parameters:
target- the initial setpointkP- the proportional gainkI- the integral gainkD- the derivative gain
-
-
Method Details
-
update
public double update(double current, double dt) Description copied from class:ControllerComputes the control output for this loop.- Specified by:
updatein classController- Parameters:
current- the current measured valuedt- the time elapsed since the previous update, in seconds- Returns:
- the control output to apply
-