controller module

class controller.PIController(actuator_cb, actuator_gain, sensor_cb, sensor_gain, saturation_range)[source]

Bases: object

Generic PI (Proportional + Integral) controller for MicroPython.

Each run() call:
  1. reads sensor

  2. computes error and dt

  3. updates integral (with anti-windup)

  4. computes PI output

  5. clamps to saturation

  6. sends to actuator

property Ki: float
property Kp: float
reset()[source]

Reset integral state and initialize the time reference.

run()[source]

Run one PI update with anti-windup protection. — Time delta (wrap-safe) —

set_feed_forward(setpoint, gain)[source]

Set feed-forward setpoint and gain.

Feed-forward effort is computed as ff_term = gain * setpoint and is added to the PI effort before saturation.

Return type:

None

property set_point: float