Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Programming (http://www.chiefdelphi.com/forums/forumdisplay.php?f=51)
-   -   PID Control Loops (http://www.chiefdelphi.com/forums/showthread.php?t=15215)

ttedrow 21-11-2002 16:39

PID Control Loops
 
This may be useful to some. I wrote a program that will control 3 seperate loops using a PID algorithm while still having enough room left in RAM to run the rest of the robot. I have tested it using Rob's emulator program but not in a real bot.

This program could be used for a 3-Axis arm or maybe steering and a 2-Axis Arm. If you would like to use my code feel free. Please let me know of any bugs or fixes that you find. :D

Have fun,
Tim Tedrow

The ZIP file with the code is now in the White Paper section.
http://www.chiefdelphi.com/forums/papers.php?s=

Brandon Martus 21-11-2002 17:01

Hey -- can you upload this to the White Papers section? It will take some load off of our database backup :p

Thanks

[EDIT]You can now download the PID Control Loop program in the white papers[/EDIT]

ttedrow 02-12-2002 13:17

I've noticed that there have been a lot of downloads but no comments. Has anyone try this program on a real bot yet?

Please let me know how it work.

rbayer 02-12-2002 16:01

Quote:

Originally posted by ttedrow
I've noticed that there have been a lot of downloads but no comments. Has anyone try this program on a real bot yet?

Please let me know how it work.

I fell your pain. Over 324 downloads from my website (not even counting ChiefDelphi), and only a handful of comments in return...

Anyway, I took a look at your code, but couldn't get it to work. From what I can tell, it will never reach the serout command because of the "run 1" command. Unfortunately, there is no way to "return" from a run, so doing "run 0" in the second slot will only cause program 0 to start over again from the very beginning. Honestly, I think you'd probably be better off using gosub/return than "run" as I think it does more what you were intending.

As always, when in doubt, try running it through RoboEmu as it supports both run and gosub.

--Rob

ttedrow 03-12-2002 08:40

rob,

I think you may not have the latest version on this code. I downloaded a copy from the white papers section and tried it. It ran under your emulator. I also checked the code and it does not contain "run 1".

EricS-Team180 04-12-2002 22:54

Tim and Rob,

You're both doing great stuff here!

I ran the code in RoboEmu last night and it seemd to load and run fine....and behave as expected.

Looking at the code, you're using an integrator gain of 1, right Tim?

Also, would you expect to include a "bias drive" depending on what you're controling? (...saw that mentioned on the parallax site, so I'm just throwing that out there)

I was also wondering if you guys know how much time the puts and gets take.
...would running 3 pid's like this eat up much of the - what is it - 25msec cycle time we have on the Stamp?

Anyway, thanks again both of you...cool stuff
:cool:

Eric Schreffler

ttedrow 05-12-2002 09:35

Eric,

Thanks for the comments.

Each loop has separate tuning values. They are set in the Loop Tuning section of the code by writing them to the scratch pad RAM on initialization.

The tuning values are:
Proportional Gain
Integral Time (number of program cycles)
Integral Step (gain)
Derivative Gain

The integral is the tricky part since it requires time to implement. The program cycle time is the only timing function available, so if your program varies in cycle time the integral part may not work as expected.

I have updated to code to use mechanical limit switches. They will stop the movement and prevent integral windup.

The ZIP file with the code is now in the White Paper section.
http://www.chiefdelphi.com/forums/papers.php?s=

EricS-Team180 05-12-2002 12:03

Thanks Tim,

I'll download the code and check it out.

...my next question was gonna be..."don't u want to be able to freeze the integrators to prevent windup?" ;) but u beat me to it!

Eric


All times are GMT -5. The time now is 14:07.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi