Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update pidautotuner.cpp #13

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

felipeserta
Copy link

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

Changed the index correction for control constants averages because of the last interation i++.
@s-t-a-n
Copy link

s-t-a-n commented Jun 3, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants