diff --git a/PID.h b/PID.h index bf6b885..4ecfe64 100644 --- a/PID.h +++ b/PID.h @@ -6,7 +6,7 @@ typedef struct { /* Controller gains */ float Kp; float Ki; - float Kd; + float Kd; /* Note: since using derivative-on-measurement, Kd needs to be negative (in contrast to conventional 'derivative-on'error') */ /* Derivative low-pass filter time constant */ float tau; diff --git a/PID_Test.c b/PID_Test.c index 5d20da9..042b8d8 100644 --- a/PID_Test.c +++ b/PID_Test.c @@ -24,7 +24,7 @@ float TestSystem_Update(float inp); int main() { /* Initialise PID controller */ - PIDController pid = { PID_KP, PID_KI, PID_KD, + PIDController pid = { PID_KP, PID_KI, -PID_KD, PID_TAU, PID_LIM_MIN, PID_LIM_MAX, SAMPLE_TIME_S };