swarmsim.util.pid#

PID Controller class

Example

from pid import PID
controller = PID(p=0.07, i=0, imax=90)
target = 100
state = 0
while(True):
    error = target - state
    state = controller(error)
    # control value with output

See also

This class was adapted from the following micropython code: openmv/openmv

Functions

clamp(x, xmin, xmax)

Classes

LivePID([p, i, d, imax])

PID([p, i, d, imax])