soccer_common.pid.PID

class soccer_common.pid.PID(Kd: float, Kp: float, Ki: float, setpoint=0.0, output_limits=None)[source]

Bases: object

Useful reusable PID class

__init__(Kd: float, Kp: float, Ki: float, setpoint=0.0, output_limits=None)[source]

Initializes the PID controller

Parameters:
  • Kd – The derivative portion of the PID controller

  • Kp – The proportial portion of the PID controller

  • Ki – The integral portion of the PID controller

  • setpoint – The point that the PID is set to

  • output_limits ([float, float]) – Max and minimum setting for the PID controller

Methods

__init__(Kd, Kp, Ki[, setpoint, output_limits])

Initializes the PID controller

reset()

Resets the PID controller to be used again

update(measurement[, delta_t])

Takes a measurement and updates the PID, returns the gain used by the PID controller

reset() None[source]

Resets the PID controller to be used again

update(measurement: float, delta_t: float = 1) float[source]

Takes a measurement and updates the PID, returns the gain used by the PID controller

Parameters:
  • measurement – The measurement used to compare against the setpoint

  • delta_t – The time passed since the measurement

Returns:

The gain to apply to the PID controller as a result