m-lundberg / simple-pid

A simple and easy to use PID controller in Python
MIT License
799 stars 217 forks source link

pid.differential_on_measurement/differetial_on_measurement not working #72

Closed jermuzet closed 1 year ago

jermuzet commented 1 year ago

Hello,

The pid doesn't detect pid.differetial_on_measurement=False and if I put it in the PID init, pid = PID(1, 0.8, 0.04, setpoint=5, output_limits=(-5, 5), differetial_on_measurement=False), I get the following error : __init__() got an unexpected keyword argument 'differetial_on_measurement'

(same for differential_on_measurement, but it is only present in the README so I don't if it's relevant)

Am I doing something wrong or is there a problem in the class ?

m-lundberg commented 1 year ago

Hi!

Wow, I only just noticed the misspelling in differential. Thanks for noticing the difference to the readme.

You probably installed simple-pid from pip, which means that you got the latest release version (1.0.1 currently). This feature was added after that release. I have been meaning to make a new release for a while, there's just a few things I wanted to finish first and I haven't found the time. When the next release comes, it will include this feature (though with the correct spelling of differential_on_measurement).

If you don't want to wait for a release, you can just take pid.py from this repo and use that in the mean time. Note that you will then need to change the spelling of differential when you update to the proper release in the future.

I'm leaving this issue open for fixing the spelling.

m-lundberg commented 1 year ago

The spelling is now fixed to be differential_on_measurement. This feature will be included in the next release.