update pid, work version

This commit is contained in:
Alekseev
2025-05-21 18:24:53 +07:00
parent 484260d6cb
commit ff8192e65e
6 changed files with 134 additions and 97 deletions

5
README.md Normal file
View File

@@ -0,0 +1,5 @@
# PID
PID controller implementation written in C.
Note on 'derivative-on-measurement': Since the 'error signal' effectively going into the differentiator does not depend on the setpoint: e[n] = 0 - measurement, and therefore (e[n] - e[n - 1]) = (0 - measurement) - (0 - prevMeasurement) = -Kd * (measurement - prevMeasurement). (Note the minus sign compared to derivative-on-error!)
I've included the minus sign in the code, so gains will have the effect as normal.