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
- class swarmsim.util.pid.PID(p: float = 0, i: float = 0, d: float = 0, imax: int = 0, min: float | None = None, max: float | None = None)[source]#
PID Class
- Parameters:
Methods
__call__(error[, time, dt])Call self as a function.
get_pid(error[, time, dt])Calculate the PID output
reset_I
Functions
|
Classes
|
|
|
PID Class |