omnid / nuhal

Miscellaneous cross-platform (including microcontroller) C utilities
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

Multiple versions of PID function exist #4

Open billiestrong opened 2 years ago

billiestrong commented 2 years ago

There is currently a pid_compute and a pid_compute_1. The original pid_compute uses a subtle anti-windup strategy, while the *_1 variant uses simple saturation for antiwindup, with the limit equal to a hardcoded fraction of the output bounds. Neither version saturates the output.

There should only be one pid_compute, and it should either use a single antiwindup strategy or offer the caller a choice of strategies. Further, the windup limit shouldn't be hardcoded.