pid module

pid

The pid module provides a PID class which is an interface to a closed-loop, proportional-integral-derivative controller.

Example(s):

Here is how you can build and use the PID class:

from pid import PID

controller = PID(
  kp=0.8,
  ki=0.1,
  kd=0.2
)

# imagine the following code is inside of a loop that is
# contantly monitoring the thing you are trying to control
reference = 11
observed  = 9
current_control_point = 10
current_control_point -= controller.feedback(reference-observed)

To read more about pid controllers see this link.

class pid.PID(kp, ki, kd, *args, **kwargs)

Bases: object

DIFFERENTIATOR_CLAMP = 8
INTEGRATOR_CLAMP = 8
PROPORTIONAL_CLAMP = 8
feedback(error)
reset()