PID

open class PID(var pGain: Double, var iGain: Double, var dGain: Double, initial: Double = 0.0, var iLimit: Double = 1.0)

PID Controller

Parameters

pGain

Proportional gain

iGain

Integral gain. Integral increases at a rate of (iGain * error) power per second.

dGain

Derivative gain. Power is equal to dGain times error change per second.

Inheritors

Constructors

Link copied to clipboard
constructor(pGain: Double, iGain: Double, dGain: Double, initial: Double = 0.0, iLimit: Double = 1.0)

Properties

Link copied to clipboard
open var d: Double
Link copied to clipboard
open var dGain: Double
Link copied to clipboard
open var f: Double
Link copied to clipboard
open var i: Double
Link copied to clipboard
open var iGain: Double
Link copied to clipboard
open var iLimit: Double
Link copied to clipboard
open var maxPower: Double
Link copied to clipboard
open var p: Double
Link copied to clipboard
open var pGain: Double
Link copied to clipboard
open var power: Double
Link copied to clipboard
open var reiniting: Boolean

Functions

Link copied to clipboard
open fun reInit()

Clears the Integral and derivative values. This should be used if a PID controller has not been in use for an extend period of time (more than a loop cycle) to avoid extreme integral build up.

Link copied to clipboard
open fun update(state: Double, goal: Double = 0.0): Double
open fun update(state: Double, velocity: Double, goal: Double = 0.0): Double

Update PID control loop