1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51
|
# simple-pid
[](https://github.com/m-lundberg/simple-pid/actions?query=workflow%3Atests)
[](https://pypi.org/project/simple-pid/)
[](https://simple-pid.readthedocs.io/)
[](https://github.com/m-lundberg/simple-pid/blob/master/LICENSE.md)
[](https://pepy.tech/project/simple-pid)
[](https://github.com/psf/black)
A simple and easy to use PID controller in Python. If you want a PID controller without external dependencies that just works, this is for you! The PID was designed to be robust with help from [Brett Beauregards guide](http://brettbeauregard.com/blog/2011/04/improving-the-beginners-pid-introduction/).
Usage is very simple:
```python
from simple_pid import PID
pid = PID(1, 0.1, 0.05, setpoint=1)
# Assume we have a system we want to control in controlled_system
v = controlled_system.update(0)
while True:
# Compute new output from the PID according to the systems current value
control = pid(v)
# Feed the PID output to the system and get its current value
v = controlled_system.update(control)
```
## Installation
To install, run:
```
python -m pip install simple-pid
```
## Documentation
Documentation, including a user guide and complete API reference, can be found [here](https://simple-pid.readthedocs.io/).
## Tests
This project has a test suite using [`pytest`](https://docs.pytest.org/). To run the tests, install `pytest` and run:
```
pytest -v
```
## License
Licensed under the [MIT License](https://github.com/m-lundberg/simple-pid/blob/master/LICENSE.md).
|