Class Controller
java.lang.Object
com.cdarobotics.cdalib.controllers.Controller
- Direct Known Subclasses:
CompoundController,FFController,NullController,PIDController
Base type for closed-loop and feedforward controllers. A controller drives a measured value
toward a
target setpoint; each loop update(double, double) is called with the
current measurement and elapsed time and returns the control output to apply.-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected doubleThe setpoint this controller is driving the measured value toward. -
Constructor Summary
Constructors -
Method Summary
-
Field Details
-
target
protected double targetThe setpoint this controller is driving the measured value toward.
-
-
Constructor Details
-
Controller
public Controller(double target) - Parameters:
target- the initial setpoint
-
-
Method Details
-
update
public abstract double update(double current, double dt) Computes the control output for this loop.- Parameters:
current- the current measured valuedt- the time elapsed since the previous update, in seconds- Returns:
- the control output to apply
-
getTarget
public double getTarget()- Returns:
- the current setpoint.
-
setTarget
public void setTarget(double target) Sets the setpoint.- Parameters:
target- the new setpoint
-