Go to Post Imagine a world solely consisting of FIRST students. Oh the things that we could do. - Ryan Himmelblau [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Closed Thread
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 21-11-2002, 16:39
ttedrow's Avatar
ttedrow ttedrow is offline
Herding electrons
AKA: Tim Tedrow
FRC #0281 (EnTech)
Team Role: Mentor
 
Join Date: Jan 2002
Rookie Year: 2000
Location: Greenville, SC
Posts: 165
ttedrow will become famous soon enoughttedrow will become famous soon enough
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=
__________________
Sr. Design Engineer
Caterpillar Inc.
Greenville, SC

KD4EGM

FRC 281 Greenvillains
Infected with the FIRST virus in 2000

Yes, Chute Door!!!

Last edited by ttedrow : 22-11-2002 at 11:03.
  #2   Spotlight this post!  
Unread 21-11-2002, 17:01
Brandon Martus's Avatar Unsung FIRST Hero
Brandon Martus Brandon Martus is offline
busy.
AKA: B. Slash Kamen
no team
 
Join Date: May 2001
Rookie Year: 1998
Location: Nevada, TX USA
Posts: 5,271
Brandon Martus has a reputation beyond reputeBrandon Martus has a reputation beyond reputeBrandon Martus has a reputation beyond reputeBrandon Martus has a reputation beyond reputeBrandon Martus has a reputation beyond reputeBrandon Martus has a reputation beyond reputeBrandon Martus has a reputation beyond reputeBrandon Martus has a reputation beyond reputeBrandon Martus has a reputation beyond reputeBrandon Martus has a reputation beyond reputeBrandon Martus has a reputation beyond repute
Send a message via ICQ to Brandon Martus Send a message via AIM to Brandon Martus Send a message via Yahoo to Brandon Martus
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]
__________________
Brandon Martus
e-mail

Last edited by Brandon Martus : 22-11-2002 at 10:04.
  #3   Spotlight this post!  
Unread 02-12-2002, 13:17
ttedrow's Avatar
ttedrow ttedrow is offline
Herding electrons
AKA: Tim Tedrow
FRC #0281 (EnTech)
Team Role: Mentor
 
Join Date: Jan 2002
Rookie Year: 2000
Location: Greenville, SC
Posts: 165
ttedrow will become famous soon enoughttedrow will become famous soon enough
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.
__________________
Sr. Design Engineer
Caterpillar Inc.
Greenville, SC

KD4EGM

FRC 281 Greenvillains
Infected with the FIRST virus in 2000

Yes, Chute Door!!!
  #4   Spotlight this post!  
Unread 02-12-2002, 16:01
rbayer's Avatar Unsung FIRST Hero
rbayer rbayer is offline
Blood, Sweat, and Code
no team (Teamless Orphan)
 
Join Date: Mar 2002
Rookie Year: 2001
Location: Minnetonka, MN
Posts: 1,087
rbayer is a glorious beacon of lightrbayer is a glorious beacon of lightrbayer is a glorious beacon of lightrbayer is a glorious beacon of lightrbayer is a glorious beacon of light
Send a message via AIM to rbayer
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
__________________
New C-based RoboEmu2 (code simulator) available at: http://www.robbayer.com/software.php
  #5   Spotlight this post!  
Unread 03-12-2002, 08:40
ttedrow's Avatar
ttedrow ttedrow is offline
Herding electrons
AKA: Tim Tedrow
FRC #0281 (EnTech)
Team Role: Mentor
 
Join Date: Jan 2002
Rookie Year: 2000
Location: Greenville, SC
Posts: 165
ttedrow will become famous soon enoughttedrow will become famous soon enough
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".
__________________
Sr. Design Engineer
Caterpillar Inc.
Greenville, SC

KD4EGM

FRC 281 Greenvillains
Infected with the FIRST virus in 2000

Yes, Chute Door!!!
  #6   Spotlight this post!  
Unread 04-12-2002, 22:54
EricS-Team180's Avatar
EricS-Team180 EricS-Team180 is offline
SPAM, the lunchmeat of superheroes!
AKA: Eric Schreffler
FRC #0180 (SPAM)
Team Role: Engineer
 
Join Date: Apr 2002
Rookie Year: 2001
Location: Stuart, Florida
Posts: 561
EricS-Team180 has a reputation beyond reputeEricS-Team180 has a reputation beyond reputeEricS-Team180 has a reputation beyond reputeEricS-Team180 has a reputation beyond reputeEricS-Team180 has a reputation beyond reputeEricS-Team180 has a reputation beyond reputeEricS-Team180 has a reputation beyond reputeEricS-Team180 has a reputation beyond reputeEricS-Team180 has a reputation beyond reputeEricS-Team180 has a reputation beyond reputeEricS-Team180 has a reputation beyond repute
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
__________________

Don't PANIC!
S. P. A. M.
  #7   Spotlight this post!  
Unread 05-12-2002, 09:35
ttedrow's Avatar
ttedrow ttedrow is offline
Herding electrons
AKA: Tim Tedrow
FRC #0281 (EnTech)
Team Role: Mentor
 
Join Date: Jan 2002
Rookie Year: 2000
Location: Greenville, SC
Posts: 165
ttedrow will become famous soon enoughttedrow will become famous soon enough
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=
__________________
Sr. Design Engineer
Caterpillar Inc.
Greenville, SC

KD4EGM

FRC 281 Greenvillains
Infected with the FIRST virus in 2000

Yes, Chute Door!!!
  #8   Spotlight this post!  
Unread 05-12-2002, 12:03
EricS-Team180's Avatar
EricS-Team180 EricS-Team180 is offline
SPAM, the lunchmeat of superheroes!
AKA: Eric Schreffler
FRC #0180 (SPAM)
Team Role: Engineer
 
Join Date: Apr 2002
Rookie Year: 2001
Location: Stuart, Florida
Posts: 561
EricS-Team180 has a reputation beyond reputeEricS-Team180 has a reputation beyond reputeEricS-Team180 has a reputation beyond reputeEricS-Team180 has a reputation beyond reputeEricS-Team180 has a reputation beyond reputeEricS-Team180 has a reputation beyond reputeEricS-Team180 has a reputation beyond reputeEricS-Team180 has a reputation beyond reputeEricS-Team180 has a reputation beyond reputeEricS-Team180 has a reputation beyond reputeEricS-Team180 has a reputation beyond repute
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
__________________

Don't PANIC!
S. P. A. M.
Closed Thread


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

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


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

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


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