PIDController

class PIDController(val kp: Double, val ki: Double = 0.0, val kd: Double = 0.0, val kf: Double = 0.0)

A PID/PIDF controller with integral clamping and output saturation.

Parameters

kp

Proportional gain

ki

Integral gain

kd

Derivative gain

kf

Feedforward gain

Constructors

Link copied to clipboard
constructor(kp: Double, ki: Double = 0.0, kd: Double = 0.0, kf: Double = 0.0)

Properties

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
val kd: Double
Link copied to clipboard
val kf: Double
Link copied to clipboard
val ki: Double
Link copied to clipboard
val kp: Double
Link copied to clipboard
Link copied to clipboard

Functions

Link copied to clipboard
fun reset()

Resets the controller state.

Link copied to clipboard
fun setOutputLimits(min: Double, max: Double)

Sets output limits.

Link copied to clipboard
open override fun toString(): String
Link copied to clipboard
fun update(error: Double, dt: Double): Double

Updates the controller with an error value and time delta.

fun update(target: Double, current: Double, normalizeRadians: Boolean = false): Double

Auto-timestamped update using system time.

fun update(target: Double, current: Double, dt: Double, normalizeRadians: Boolean = false): Double

Updates the controller with target and current values.