|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
||||
|
||||
|
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. 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= Last edited by ttedrow : 22-11-2002 at 11:03. |
|
#2
|
|||||
|
|||||
|
Hey -- can you upload this to the White Papers section? It will take some load off of our database backup
![]() Thanks [EDIT]You can now download the PID Control Loop program in the white papers[/EDIT] Last edited by Brandon Martus : 22-11-2002 at 10:04. |
|
#3
|
||||
|
||||
|
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. |
|
#4
|
||||||
|
||||||
|
Quote:
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 |
|
#5
|
||||
|
||||
|
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". |
|
#6
|
|||||
|
|||||
|
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 Eric Schreffler |
|
#7
|
||||
|
||||
|
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= |
|
#8
|
|||||
|
|||||
|
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 |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Need a FIRST Robotics control system | kershawrobotics | General Forum | 3 | 07-07-2003 09:49 |
| Serious Controller Ideas | archiver | 1999 | 28 | 23-06-2002 23:01 |
| Ok, how much is the control system worth? | archiver | 2001 | 6 | 23-06-2002 22:05 |
| more control options | smokescreen | Technical Discussion | 17 | 05-03-2002 15:41 |
| goals: how much control? | Pat Sarmiento | Rules/Strategy | 2 | 18-01-2002 19:10 |