core / com.acmerobotics.roadrunner.control / PIDFController

PIDFController

class PIDFController

PID controller with various feedforward components. kV, kA, and kStatic are designed for DC motor feedforward control (the most common kind of feedforward in FTC). kF provides a custom feedforward term for other plants.

Parameters

pid - traditional PID coefficients

kV - feedforward velocity gain

kA - feedforward acceleration gain

kStatic - additive feedforward constant

kF - custom, position-dependent feedforward (e.g., a gravity term for arms)

clock - clock

Constructors

<init>

PIDFController(pid: PIDCoefficients, kV: Double = 0.0, kA: Double = 0.0, kStatic: Double = 0.0, kF: (Double) -> Double = { 0.0 }, clock: NanoClock = NanoClock.system())

PID controller with various feedforward components. kV, kA, and kStatic are designed for DC motor feedforward control (the most common kind of feedforward in FTC). kF provides a custom feedforward term for other plants.

Properties

lastError

var lastError: Double

Error computed in the last call to update.

targetPosition

var targetPosition: Double

Target position (that is, the controller setpoint).

Functions

reset

fun reset(): Unit

Reset the controller's integral sum.

setInputBounds

fun setInputBounds(min: Double, max: Double): Unit

Sets bound on the input of the controller. The min and max values are considered modularly-equivalent (that is, the input wraps around).

setOutputBounds

fun setOutputBounds(min: Double, max: Double): Unit

Sets bounds on the output of the controller.

update

fun update(position: Double, velocity: Double = 0.0, acceleration: Double = 0.0): Double

Run a single iteration of the controller.