Skip to content

Latest commit

 

History

44 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pidkit

A minimal, dependency-free PID controller for Python.

Install

Latest version:

pip install git+https://github.com/chrisfox9158/pidkit.git

v0.2.1:

pip install git+https://github.com/chrisfox9158/pidkit.git@v0.2.1

Quick usage

from pidkit import PID

pid = PID(kp=1.0, ki=0.1, kd=0.05, setpoint=100)
correction = pid.compute(pv=95, dt=0.1)

Don't know what gains to use for your sim? Let pidkit find them:

from pidkit import autotune_sim, PID

result = autotune_sim(
    plant_factory=lambda: MyPlant(...),
    setpoint=100,
    dt=0.1,
    steps=600,
)

pid = PID(kp=result.kp, ki=result.ki, kd=result.kd, setpoint=100)

For full usage details:

  • Controller — pidkit essential use; the PID class, timing modes, output limiting
  • Autotuningautotune_sim, the aggression parameter, validation results

What's new?

v0.2.1

  • Bug fixes — resolved an IndexError and a related logic gap in settling-time detection (_find_tolerance_margin).

v0.2.0

  • autotune_sim — automatic PID gain discovery against any simulated plant, requiring only a minimal step/get_state interface (pidkit.SimPlant).
  • TuneResult — structured result object with tuned gains, the full final-trial trace, and diagnostic metrics (settling time, overshoot, oscillation count, final cost).
  • Keyword-only arguments on PID.__init__ and PID.compute(), preventing silent transposition of same-typed arguments like kp/ki.

See CHANGELOG.md for the full version history.

License

MIT License — see LICENSE

About

Minimal, dependency-free PID controller for Python

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages