Class AngleController
java.lang.Object
com.stuypulse.stuylib.control.angle.AngleController
- Direct Known Subclasses:
AngleArmFeedforward
,AngleControllerGroup
,AnglePIDController
,AnglePositionFeedforwardController
Base class of controller classes of continuous systems. This means that both the setpoint and
measurement are angles, as opposed to just numbers.
Other than this, works the same as the Controller class.
- See Also:
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionfinal AngleControllerGroup
add
(AngleController... other) Combines this controller into a group with other controllers that share the same setpoint and measurement.protected abstract double
Calculates the output of the controller given a setpoint and measurement.final Angle
getError()
final Angle
final double
final Angle
final boolean
isDoneDegrees
(double acceptableError) Determines if the controller is finished based on an acceptable degree error.final boolean
isDoneRadians
(double acceptableError) Determines if the controller is finished based on an acceptable radian error.final AngleController
setMeasurementFilter
(AFilter... measurementFilter) Set the measurement filter of the controllerfinal AngleController
setOutputFilter
(IFilter... outputFilter) Set the output filter of the controllerfinal AngleController
setSetpointFilter
(AFilter... setpointFilter) Set the setpoint filter of the controllerfinal double
Updates the state of the controller.
-
Constructor Details
-
AngleController
public AngleController()Default initialization of an angle controller
-
-
Method Details
-
setSetpointFilter
Set the setpoint filter of the controller- Parameters:
setpointFilter
- angular setpoint filters- Returns:
- reference to the controller
-
setMeasurementFilter
Set the measurement filter of the controller- Parameters:
measurementFilter
- angular measurement filters- Returns:
- reference to the controller
-
setOutputFilter
Set the output filter of the controller- Parameters:
outputFilter
- output filters- Returns:
- reference to the controller
-
getSetpoint
- Returns:
- the most recent setpoint of the controller
-
getMeasurement
- Returns:
- the most recent measurement of the controller
-
getOutput
public final double getOutput()- Returns:
- the most recent output of the controller
-
getError
- Returns:
- the most recent error of the controller
-
isDoneRadians
public final boolean isDoneRadians(double acceptableError) Determines if the controller is finished based on an acceptable radian error.- Parameters:
acceptableError
- acceptable error for the controller- Returns:
- whether or not the controller is done
-
isDoneDegrees
public final boolean isDoneDegrees(double acceptableError) Determines if the controller is finished based on an acceptable degree error.- Parameters:
acceptableError
- acceptable error for the controller- Returns:
- whether or not the controller is done
-
add
Combines this controller into a group with other controllers that share the same setpoint and measurement.- Parameters:
other
- the other controllers- Returns:
- the group of controllers that
-
update
Updates the state of the controller.Applies filters to setpoint and measurement, calculates output with filtered values, filters and returns output
- Parameters:
setpoint
- setpoint of the variable being controlledmeasurement
- measurement of the variable being controlled- Returns:
- the final output
-
calculate
Calculates the output of the controller given a setpoint and measurement.- Parameters:
setpoint
- setpointmeasurement
- measurement- Returns:
- calculated output
-