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

PID Control #4

Open
gcorthey opened this issue Sep 4, 2019 · 5 comments
Open

PID Control #4

gcorthey opened this issue Sep 4, 2019 · 5 comments

Comments

@gcorthey
Copy link
Collaborator

gcorthey commented Sep 4, 2019

@juanstdio please, go back to version 0.02 of the code an work on the proper implementation of the PID control.

Your code looks good, I would remove the condition loop and leave the calculation of PID_i out of it.:

  if(-3 < PID_error <3) //Calculate the I value in a range on +-3, 
  {
    PID_i = PID_i + (ki * PID_error);
  }

Have you followed the explanation of the PID library here?
You can also use the PID library directly.

Also there is nice explanation here with a interactive IPhython Notebook that you can download and execute here

For tuning the parameteres, first you can just use PI control and see how it works and then add D also.

Cheers

Gaston

@juanstdio
Copy link
Collaborator

I would remove the condition loop and leave the calculation of PID_i out of it.:

Solved in commit #6593f4aff6ff25d2b05d3076212be09fb5a14ec0

For tuning the parameteres, first you can just use PI control and see how it works and then add D also.

Tunning only using PI was impossible because the overshoot was too high.

@gcorthey
Copy link
Collaborator Author

gcorthey commented Sep 6, 2019

I would remove the condition loop and leave the calculation of PID_i out of it.:

Solved in commit #6593f4aff6ff25d2b05d3076212be09fb5a14ec0

I don't see that, it was completely removed and only p and d left... We need to work on that...it must be possible to have a PI or PID control....please read throughly the guides I sent you to completely understand the details of the process.

For tuning the parameteres, first you can just use PI control and see how it works and then add D also.

Tunning only using PI was impossible because the overshoot was too high.

Why is that? have you tried different parameters for P and I? there might be a problem there. It is necessary to follow a PID tuning protocol to achieve the correct parameters. You should follow this procedure for example.

@amchagas
Copy link
Member

amchagas commented Sep 6, 2019

Hi folks,

I don't know if this is useful, but someone wrote and documented a PID library for arduino: https://github.com/br3ttb/Arduino-PID-Library/

@amchagas
Copy link
Member

amchagas commented Sep 6, 2019

Also this might be useful http://ospid.com/blog/

@juanstdio
Copy link
Collaborator

Hi,
Check the version 0.0.4, might be the solution of the PID Control

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

No branches or pull requests

3 participants