arduino-pid-autotuner icon indicating copy to clipboard operation
arduino-pid-autotuner copied to clipboard

Update pidautotuner.cpp

Open felipeserta opened this issue 3 years ago • 1 comments

Changed the index correction for control constants averages because of the last interation i++.

felipeserta avatar Oct 04 '22 13:10 felipeserta

I was wondering too about the index correctness, but see the conditional block starting at 140:

            // Average all gains after the first two cycles
            if (cycle > 1) {
                pAverage += kp;
                iAverage += ki;
                dAverage += kd;
            }

The decrement seems to derive from that, not from the iteration. i == 1 when 1 cycle has completed. I assume the first cycle is discarded as the process is likely in a cold state and this serves to saturate the process first.

s-t-a-n avatar Jun 03 '24 14:06 s-t-a-n