m-lundberg / simple-pid

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

Use output_limits setter in __init__() rather than setting the elements manually #25

Closed m-lundberg closed 4 years ago

m-lundberg commented 4 years ago

In PID.__init__(), the output_limits setter should be used rather than setting self._min_output and self._max_output directly. As it is now, the checks done in the setter (min < max etc.) are not done if setting the limits through __init__(), so the values can be weird.

It should also be done after the call to self.reset() so that the integral term is clamped properly from the beginning.