Skip to content

Getting Started

The simplest control system is a PID. Creating one is simple:

kotlin
val controlSystem = controlSystem {
    posPid(p, i, d)
}

To run the control system's calculations, call calculate every loop. Pass a KineticState consisting of the current position and velocity, and optionally, the acceleration. Calling calculate returns the motor power to set.

kotlin
motor.power = controlSystem.calculate(
  KineticState(motor.position, motor.velocity)
);