ProfiledPIDController

Implements a PID control loop whose setpoint is constrained by a trapezoid profile. Source

Since

3.5.0

Constructors

Link copied to clipboard
constructor(Kp: Double, Ki: Double, Kd: Double, constraints: TrapezoidProfile.Constraints)
Allocates a ProfiledPIDController with the given constants for Kp, Ki, and Kd.

Properties

Link copied to clipboard
Link copied to clipboard

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 atSetpoint(): 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, newGoal: TrapezoidProfile.State): Double
open fun calculate(measurement: Double, newGoal: TrapezoidProfile.State, 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
Gets the current coefficients for this controller.
Link copied to clipboard
open fun getD(): Double
Gets the differential coefficient.
Link copied to clipboard
open fun getI(): Double
Gets the integral coefficient.
Link copied to clipboard
open fun getP(): Double
Gets the proportional coefficient.
Link copied to clipboard
open fun getPeriod(): Double
Gets the period of this controller.
Link copied to clipboard
Link copied to clipboard
Returns the difference between the setpoint and the measurement.
Link copied to clipboard
Returns the change in error per second.
Link copied to clipboard
open fun reset()
Reset the previous error, the integral term, and disable the controller.
open fun reset(measuredPosition: Double)
open fun reset(measurement: TrapezoidProfile.State)
open fun reset(measuredPosition: Double, measuredVelocity: Double)
Reset the previous error and the integral term.
Link copied to clipboard
open fun setCoefficients(coeffs: Array<Double>)
Sets the coefficients for this controller.
Link copied to clipboard
Set velocity and acceleration constraints for goal.
Link copied to clipboard
open fun setD(Kd: Double)
Sets the differential coefficient of the PID controller gain.
Link copied to clipboard
open fun setGoal(goal: Double)
Sets the goal for the ProfiledPIDController.
Link copied to clipboard
open fun setI(Ki: Double)
Sets the integral coefficient of the PID controller gain.
Link copied to clipboard
open fun setP(Kp: Double)
Sets the proportional coefficient of the PID controller gain.
Link copied to clipboard
open fun setPID(Kp: Double, Ki: Double, Kd: Double)
Sets the PID Controller gain parameters.
Link copied to clipboard
open fun setTolerance(positionTolerance: Double)
open fun setTolerance(positionTolerance: Double, velocityTolerance: Double)
Sets the error which is considered tolerable for use with atSetpoint().