py-feedback-controller
This library implements various feedback controllers in C++ to use in Python. As of latest, the implemented feedback controllers are:
- ordinary PID controller
- auto-optimizing PID controller
Installation
To install the package, you can either build directly of this repo or use pip:
pip install py-feedback-controller
Usage
While the test folder of this repo has a small test script, a similar example will be shown.
from pyfc.pid import AutoOptimizingPID
from matplotlib.animation import FuncAnimation
from matplotlib import pyplot as plt
import numpy as np
setpoint = 1.0
pid = AutoOptimizingPID(setpoint=setpoint, lr=1.0)
pid.init()
z = [0.0]
t = [0.0]
dt = 1e-3
fig, ax = plt.subplots()
line = ax.plot(t, z)[0]
def func(frame):
global setpoint
if (frame % 500) == 0:
if setpoint == 1.0:
setpoint = 2.0
elif setpoint == 2.0:
setpoint = 1.0
pid.setSetpoint(setpoint)
pid_out = pid.requestLoop(z[frame-1])
z.append(z[frame-1] + dt * pid_out)
t.append(t[frame-1] + dt)
line.set_xdata(t)
line.set_ydata(z)
ax.set_ylim(-0.1, 1.2*np.max(z))
ax.set_xlim(0, 1.2*np.max(t))
anim = FuncAnimation(fig, func, frames=10000, interval=1)
plt.grid()
plt.show()
Metadata
Release files for py-feedback-controller 0.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| py_feedback_controller-0.1.2.tar.gz | 10.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| py_feedback_controller-0.1.2-cp313-cp313-win_amd64.whl | CPython 3.13 | CPython 3.13 | Windows x86-64 | Details |
Total release size: 117.7 kB
Release files / py_feedback_controller-0.1.2.tar.gz
| Download URL | py_feedback_controller-0.1.2.tar.gz |
|---|---|
| Size | 10.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c8b122fda605a35bc09e3c36004a3727409331adc48b4e6d9502504bcf8a50b0
|
|
BLAKE2b-256 checksum How to use checksums |
24ee944241e3fc11bf4cf4cc800273df049690aebb2792ef20855fca29e6802b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.9
|
Release files / py_feedback_controller-0.1.2-cp313-cp313-win_amd64.whl
| Download URL | py_feedback_controller-0.1.2-cp313-cp313-win_amd64.whl |
|---|---|
| Size | 107.2 kB |
| Tags | CPython 3.13 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
1d7389788fd813049cc61d643bebb572a0e14f93a9b7a3f24ed4c7a7a581ae2f
|
|
BLAKE2b-256 checksum How to use checksums |
8e40ab6f2d81da00a246961f253d382cba0914681d0a2d6f445a0a4c1c49f737
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.9
|