ProfiledPIDController

Implements a PID control loop whose setpoint is constrained by a trapezoid profile. Users should call reset() when they first start running the controller to avoid unwanted behavior. Source

Since

3.5.0

Constructors

Link copied to clipboard
constructor(kP: Double, kI: Double, kD: Double, @NonNull constraints: TrapezoidProfile.Constraints)
Allocates a ProfiledPIDController with the given constants for kP, kI, and kD.

Properties

Link copied to clipboard

Inherited properties

Link copied to clipboard
Whether to clear the integral term when a new setpoint is set.
Link copied to clipboard
protected open var continuousInput: Boolean
Link copied to clipboard
The default smoothing/low-pass gain for the derivative (kD) term.
Link copied to clipboard
The derivative/velocity error tolerance.
Link copied to clipboard
The positional error tolerance.
Link copied to clipboard
open var iZone: Double
The zone around the error where the integral term is active.
Link copied to clipboard
open var kD: Double
Derivative gain.
Link copied to clipboard
open var kF: Double
Feedforward setpoint gain.
Link copied to clipboard
open var kI: Double
Integral gain.
Link copied to clipboard
open var kP: Double
Proportional gain.
Link copied to clipboard
open var lowerClamp: Double
The lower clamp for the output.
Link copied to clipboard
protected open var maxContinuousInput: Double
Link copied to clipboard
open var maxIClamp: Double
The maximum applied value for the integral term.
Link copied to clipboard
protected open var minContinuousInput: Double
Link copied to clipboard
open var minIClamp: Double
The minimum applied value for the integral term.
Link copied to clipboard
A null controller that does nothing.
Link copied to clipboard
open val period: Double
Link copied to clipboard
open var upperClamp: Double
The upper clamp for the output.

Functions

Link copied to clipboard
open fun atGoal(): Boolean
Returns true if the error is within the tolerance of the error.
Link copied to clipboard
open fun calculate(measurement: Double): Double
open fun calculate(measurement: Double, @NonNull newGoal: TrapezoidProfile.State): Double
open fun calculate(measurement: Double, @NonNull newGoal: TrapezoidProfile.State, @NonNull newConstraints: TrapezoidProfile.Constraints): Double
Returns the next output of the PID controller.
open fun calculate(measurement: Double, newGoal: Double): Double
Returns the next output of the PIDController.
Link copied to clipboard
Returns the current setpoint of the ProfiledPIDController.
Link copied to clipboard
open fun reset(measuredPosition: Double): ProfiledPIDController
open fun reset(measuredPosition: Double, measuredVelocity: Double): ProfiledPIDController
Reset the previous error and the integral term.
Link copied to clipboard
Set velocity and acceleration constraints for goal.
Link copied to clipboard
Sets the goal for the ProfiledPIDController.

Inherited functions

Link copied to clipboard
open fun atSetpoint(): Boolean
Returns true if the error is within the percentage of the total input range, determined by setTolerance.
Link copied to clipboard
abstract fun calculate(process: Double, setpoint: Double): Double
Calculate the next output of this control algorithm.
open fun calculate(): Double
Calculates the next output of the PIDF controller.
Link copied to clipboard
Clear the integral term.
Link copied to clipboard
Composes this controller with another controller, returning a new controller that is the composition of the two.
Link copied to clipboard
Disables continuous input.
Link copied to clipboard
open fun enableContinuousInput(minInput: Double, maxInput: Double): PIDFController
Enables continuous input.
Link copied to clipboard
Link copied to clipboard
open fun getD(): Double
Link copied to clipboard
Get the derivative smoothing coefficient.
Link copied to clipboard
open fun getError(): Double
Link copied to clipboard
Link copied to clipboard
open fun getF(): Double
Link copied to clipboard
open fun getI(): Double
Link copied to clipboard
open fun getP(): Double
Link copied to clipboard
open fun getSetpoint(): Double
Returns the current setpoint of the PIDFController.
Link copied to clipboard
Link copied to clipboard
open fun getTotalError(): Double
Link copied to clipboard
Whether the input is continuous.
Link copied to clipboard
Get the PIDF controller associated with this controller, if applicable.
Link copied to clipboard
open fun reset()
Resets the PIDF controller.
Link copied to clipboard
Sets whether the integral term should be cleared when a new setpoint is set.
Link copied to clipboard
open fun setCoefficients(@NonNull coeffs: Array<Double>)
Sets the coefficients for this controller.
open fun setCoefficients(@NonNull coeffs: Array<Double>)
Note!
Link copied to clipboard
Set the Derivative coefficient on this controller
Link copied to clipboard
Set the derivative smoothing coefficient.
Link copied to clipboard
Set the setpoint Feedforward coefficient on this controller
Link copied to clipboard
Set the Integral coefficient on this controller
Link copied to clipboard
open fun setIntegrationBounds(integralMin: Double, integralMax: Double): PIDFController
Set the bounds for the integral term.
Link copied to clipboard
Sets the Integration zone range.
Link copied to clipboard
Clamps the maximum output magnitude that can be achieved via calculate.
Link copied to clipboard
Set the Proportional coefficient on this controller
Link copied to clipboard
open fun setPID(@NonNull coefficients: PIDCoefficients): PIDController
open fun setPID(kp: Double, ki: Double, kd: Double): PIDController
Set the current controller PID coefficients to the given coefficients.
Link copied to clipboard
open fun setPIDF(@NonNull coefficients: PIDFCoefficients): PIDFController
open fun setPIDF(kp: Double, ki: Double, kd: Double, kf: Double): PIDFController
Set the current controller PID coefficients to the given coefficients.
Link copied to clipboard
Sets the setpoint for the PIDFController
Link copied to clipboard
open fun setTolerance(positionTolerance: Double): PIDFController
open fun setTolerance(positionTolerance: Double, derivativeTolerance: Double): PIDFController
Sets the error which is considered tolerable for use with atSetpoint.
Link copied to clipboard
open fun updatePID(@NonNull coefficients: PIDCoefficients): PIDController
Update the supplied PID coefficients with the current controller values.
Link copied to clipboard
open fun updatePIDF(@NonNull coefficients: PIDFCoefficients): PIDFController
Update the supplied PID coefficients with the current controller values.