Go to Post Mmmmm, First Choice day. I can already taste the latency. - ttldomination [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 10-04-2006, 22:44
Matt Krass's Avatar
Matt Krass Matt Krass is offline
"Old" and Cranky. Get off my lawn!
AKA: Dark Ages
FRC #0263 (Sachem Aftershock)
Team Role: Mentor
 
Join Date: Oct 2002
Rookie Year: 2002
Location: Long Island, NY
Posts: 1,187
Matt Krass has a reputation beyond reputeMatt Krass has a reputation beyond reputeMatt Krass has a reputation beyond reputeMatt Krass has a reputation beyond reputeMatt Krass has a reputation beyond reputeMatt Krass has a reputation beyond reputeMatt Krass has a reputation beyond reputeMatt Krass has a reputation beyond reputeMatt Krass has a reputation beyond reputeMatt Krass has a reputation beyond reputeMatt Krass has a reputation beyond repute
Send a message via AIM to Matt Krass
paper: PID Control Theory for FRC Programming

Thread created automatically to discuss a document in CD-Media.

PID Control Theory for FRC Programming by
__________________
Matt Krass
If I suggest something to try and fix a problem, and you don't understand what I mean, please PM me!

I'm a FIRST relic of sorts, I remember when we used PBASIC and we got CH Flightsticks in the KoP. In my day we didn't have motorized carts, we pushed our robots uphill, both ways! (Houston 2003!)
  #2   Spotlight this post!  
Unread 10-04-2006, 22:44
Mike's Avatar
Mike Mike is offline
has common ground with Matt Krass
AKA: Mike Sorrenti
FRC #0237 (Sie-H2O-Bots (See-Hoe-Bots) [T.R.I.B.E.])
Team Role: Programmer
 
Join Date: Dec 2004
Rookie Year: 2004
Location: Watertown, CT
Posts: 1,003
Mike has a reputation beyond reputeMike has a reputation beyond reputeMike has a reputation beyond reputeMike has a reputation beyond reputeMike has a reputation beyond reputeMike has a reputation beyond reputeMike has a reputation beyond reputeMike has a reputation beyond reputeMike has a reputation beyond reputeMike has a reputation beyond reputeMike has a reputation beyond repute
Re: paper: PID Control Theory for FRC Programming

Great job, helped me out a bunch.
__________________
http://www.mikesorrenti.com/
  #3   Spotlight this post!  
Unread 10-04-2006, 22:51
Tom Bottiglieri Tom Bottiglieri is offline
Registered User
FRC #0254 (The Cheesy Poofs)
Team Role: Engineer
 
Join Date: Jan 2004
Rookie Year: 2003
Location: San Francisco, CA
Posts: 3,186
Tom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond repute
Re: paper: PID Control Theory for FRC Programming

Just a note:

The equations given in text state the following:

POUT = KP * KERR

But your code shows the proper integer based math method of performing this expression.

POUT = KERR * KP

It's quite clear why the variables need to assume this order, but I did not find it documented that there IS a difference between the "text book" equation and your example.. (it is more accurate to "round" later in the equation, after your numbers have built up.)

Either way, great paper! I plan to include this in my "required reading" for new programmers on my team.
  #4   Spotlight this post!  
Unread 10-04-2006, 23:59
Matt Krass's Avatar
Matt Krass Matt Krass is offline
"Old" and Cranky. Get off my lawn!
AKA: Dark Ages
FRC #0263 (Sachem Aftershock)
Team Role: Mentor
 
Join Date: Oct 2002
Rookie Year: 2002
Location: Long Island, NY
Posts: 1,187
Matt Krass has a reputation beyond reputeMatt Krass has a reputation beyond reputeMatt Krass has a reputation beyond reputeMatt Krass has a reputation beyond reputeMatt Krass has a reputation beyond reputeMatt Krass has a reputation beyond reputeMatt Krass has a reputation beyond reputeMatt Krass has a reputation beyond reputeMatt Krass has a reputation beyond reputeMatt Krass has a reputation beyond reputeMatt Krass has a reputation beyond repute
Send a message via AIM to Matt Krass
Re: paper: PID Control Theory for FRC Programming

Quote:
Originally Posted by Tom Bottiglieri
Just a note:

The equations given in text state the following:

POUT = KP * KERR

But your code shows the proper integer based math method of performing this expression.

POUT = KERR * KP

It's quite clear why the variables need to assume this order, but I did not find it documented that there IS a difference between the "text book" equation and your example.. (it is more accurate to "round" later in the equation, after your numbers have built up.)

Either way, great paper! I plan to include this in my "required reading" for new programmers on my team.
I'll keep that in mind for the next revision of the paper. Meanwhile if anyone has any comments or suggestions, feel free to post them here, or PM/Email them to me. I hope this paper is of use to everyone and I'm also available to answer specific questions either through CD or the contact information in the paper.

Good luck!
__________________
Matt Krass
If I suggest something to try and fix a problem, and you don't understand what I mean, please PM me!

I'm a FIRST relic of sorts, I remember when we used PBASIC and we got CH Flightsticks in the KoP. In my day we didn't have motorized carts, we pushed our robots uphill, both ways! (Houston 2003!)
  #5   Spotlight this post!  
Unread 11-04-2006, 00:03
Unsung FIRST Hero
Greg Marra Greg Marra is offline
[automate(a) for a in tasks_to_do]
FRC #5507 (Robotic Eagles)
Team Role: Mentor
 
Join Date: Oct 2004
Rookie Year: 2005
Location: San Francisco, CA
Posts: 2,030
Greg Marra has a reputation beyond reputeGreg Marra has a reputation beyond reputeGreg Marra has a reputation beyond reputeGreg Marra has a reputation beyond reputeGreg Marra has a reputation beyond reputeGreg Marra has a reputation beyond reputeGreg Marra has a reputation beyond reputeGreg Marra has a reputation beyond reputeGreg Marra has a reputation beyond reputeGreg Marra has a reputation beyond reputeGreg Marra has a reputation beyond repute
Re: paper: PID Control Theory for FRC Programming

Well written and very clear!

You may want to consider adding some comments to the code examples, such as why you limit to +-127 in case any completely new FRC programmers read this.
  #6   Spotlight this post!  
Unread 12-01-2007, 15:21
Mike's Avatar
Mike Mike is offline
has common ground with Matt Krass
AKA: Mike Sorrenti
FRC #0237 (Sie-H2O-Bots (See-Hoe-Bots) [T.R.I.B.E.])
Team Role: Programmer
 
Join Date: Dec 2004
Rookie Year: 2004
Location: Watertown, CT
Posts: 1,003
Mike has a reputation beyond reputeMike has a reputation beyond reputeMike has a reputation beyond reputeMike has a reputation beyond reputeMike has a reputation beyond reputeMike has a reputation beyond reputeMike has a reputation beyond reputeMike has a reputation beyond reputeMike has a reputation beyond reputeMike has a reputation beyond reputeMike has a reputation beyond repute
Re: paper: PID Control Theory for FRC Programming

I used this paper today as a reference when writing 237's PID control code.

Bumping it up to bring to the attention of other teams.
__________________
http://www.mikesorrenti.com/
  #7   Spotlight this post!  
Unread 12-01-2007, 17:51
Guy Davidson Guy Davidson is offline
Registered User
AKA: formerly sumadin
FRC #0008 (Paly Robotics)
Team Role: Alumni
 
Join Date: Mar 2005
Rookie Year: 2005
Location: Ra'anana, Israel
Posts: 660
Guy Davidson is a splendid one to beholdGuy Davidson is a splendid one to beholdGuy Davidson is a splendid one to beholdGuy Davidson is a splendid one to beholdGuy Davidson is a splendid one to beholdGuy Davidson is a splendid one to beholdGuy Davidson is a splendid one to beholdGuy Davidson is a splendid one to behold
Send a message via ICQ to Guy Davidson Send a message via AIM to Guy Davidson Send a message via MSN to Guy Davidson
Re: paper: PID Control Theory for FRC Programming

Thank you very much for this paper. This really helped me undferstand the concept of a PID, and will definetly be used when we write our PID code.

-Guy
  #8   Spotlight this post!  
Unread 19-02-2007, 10:30
LieAfterLie's Avatar
LieAfterLie LieAfterLie is offline
Registered User
FRC #2028
Team Role: Programmer
 
Join Date: Jan 2007
Rookie Year: 2007
Location: Hampton, VA
Posts: 35
LieAfterLie is an unknown quantity at this point
Re: paper: PID Control Theory for FRC Programming

Very helpful. You might want to move the P code example showing the #define KP 5 / 10 to between the P and I sections though, as it doesn't show I control.

I finally learned what this PID stuff is about, thanks.

You might want to also mention that since motor velocity control is a speed you're comparing encoder ticks per time rather than a target value that has a defined range, and therefore also give us a simple method for determining the range, such as maybe start at this many ticks per time period as the min/max, then scale it down when the motor is full and gives less than that number, then printf that max to initialize it to for future code so that it starts out at the right range. I know this really goes beyond the basic PID concept, but it is relevant to speed control.
__________________
SEMPER UBI SUB UBI

Last edited by LieAfterLie : 19-02-2007 at 11:44.
  #9   Spotlight this post!  
Unread 19-02-2007, 10:59
LieAfterLie's Avatar
LieAfterLie LieAfterLie is offline
Registered User
FRC #2028
Team Role: Programmer
 
Join Date: Jan 2007
Rookie Year: 2007
Location: Hampton, VA
Posts: 35
LieAfterLie is an unknown quantity at this point
Re: paper: PID Control Theory for FRC Programming

Maybe even add some visual aids, graphs... ?
__________________
SEMPER UBI SUB UBI
  #10   Spotlight this post!  
Unread 18-05-2007, 13:30
kwilliam's Avatar
kwilliam kwilliam is offline
Registered User
FRC #1038
 
Join Date: Jan 2007
Location: Ohio
Posts: 8
kwilliam has a spectacular aura aboutkwilliam has a spectacular aura about
Excellent paper!

Matt, this is an AWESOME paper! I wish I had read it earlier when I was learning PID control this year. I read this one instead and had the programming team read it, but your paper is an improvement. Wonderful explanations, good example code, and excellant usage scenarios! I will be sure to include a link to your paper in our own programming team's handbook.
  #11   Spotlight this post!  
Unread 18-05-2007, 17:23
tseres's Avatar
tseres tseres is offline
obsessed with FIRST...
FRC #1565 (Think Tank Tech)
Team Role: Leadership
 
Join Date: Apr 2007
Rookie Year: 2007
Location: Cambridge, ON
Posts: 305
tseres is a glorious beacon of lighttseres is a glorious beacon of lighttseres is a glorious beacon of lighttseres is a glorious beacon of lighttseres is a glorious beacon of lighttseres is a glorious beacon of light
Re: Excellent paper!

...
[dotdotdot]
i'm a new programmer, and well, i don't understand how this works....i sort of understand the concept...you get feedback somehow from the robot....ya...that's about all i understand....
__________________


  #12   Spotlight this post!  
Unread 21-05-2007, 09:46
Qbranch Qbranch is offline
wow college goes fast.
AKA: Alex
FRC #1024 (Kil-A-Bytes)
Team Role: Alumni
 
Join Date: Apr 2006
Rookie Year: 2006
Location: Indianapolis
Posts: 1,174
Qbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond repute
Re: Excellent paper!

Quote:
Originally Posted by tseres View Post
...
[dotdotdot]
i'm a new programmer, and well, i don't understand how this works....i sort of understand the concept...you get feedback somehow from the robot....ya...that's about all i understand....
A little off topic, but, if you need some help with the interfaces to sensors and such, i'll be happy to help. Also, check out this post on on-chip peripherals and this one on encoders..

If you are going to IRI, just come by the field and you'll see the 1024 pit area. Ask anyone on the team for "Q" and they'll point you in the right direction. Good luck!

-q
__________________
Electrical Engineer Illini
1024 | Programmer '06, '07, '08 | Driver '08
  #13   Spotlight this post!  
Unread 21-05-2007, 12:29
tseres's Avatar
tseres tseres is offline
obsessed with FIRST...
FRC #1565 (Think Tank Tech)
Team Role: Leadership
 
Join Date: Apr 2007
Rookie Year: 2007
Location: Cambridge, ON
Posts: 305
tseres is a glorious beacon of lighttseres is a glorious beacon of lighttseres is a glorious beacon of lighttseres is a glorious beacon of lighttseres is a glorious beacon of lighttseres is a glorious beacon of light
Re: Excellent paper!

thanks so much....although i wont be going to IRI...lol....but thanks
__________________


  #14   Spotlight this post!  
Unread 23-05-2007, 17:25
tseres's Avatar
tseres tseres is offline
obsessed with FIRST...
FRC #1565 (Think Tank Tech)
Team Role: Leadership
 
Join Date: Apr 2007
Rookie Year: 2007
Location: Cambridge, ON
Posts: 305
tseres is a glorious beacon of lighttseres is a glorious beacon of lighttseres is a glorious beacon of lighttseres is a glorious beacon of lighttseres is a glorious beacon of lighttseres is a glorious beacon of light
Re: Excellent paper!

ahhhhh...after looking at a lot of other things....

so i guess PID is basically having software control the robot rather than just the PWM outputs are the same as the joystick values...so there's a layer of software that processes all the input and output data.
__________________


  #15   Spotlight this post!  
Unread 23-05-2007, 17:54
JBotAlan's Avatar
JBotAlan JBotAlan is offline
Forever chasing the 'bot around
AKA: Jacob Rau
FRC #5263
Team Role: Mentor
 
Join Date: Sep 2004
Rookie Year: 2004
Location: Riverview, MI
Posts: 723
JBotAlan has a reputation beyond reputeJBotAlan has a reputation beyond reputeJBotAlan has a reputation beyond reputeJBotAlan has a reputation beyond reputeJBotAlan has a reputation beyond reputeJBotAlan has a reputation beyond reputeJBotAlan has a reputation beyond reputeJBotAlan has a reputation beyond reputeJBotAlan has a reputation beyond reputeJBotAlan has a reputation beyond reputeJBotAlan has a reputation beyond repute
Send a message via AIM to JBotAlan Send a message via Yahoo to JBotAlan
Re: Excellent paper!

Quote:
Originally Posted by tseres View Post
ahhhhh...after looking at a lot of other things....

so i guess PID is basically having software control the robot rather than just the PWM outputs are the same as the joystick values...so there's a layer of software that processes all the input and output data.
Exactly. Programming this way makes you paranoid--you start to trust the code, have a sensor go bad on you, the arm takes off and tries to rip the control system off the robot while destroying a gear box (BaneBots... ) and you don't hit the disable switch fast enough. (true story, times about 50 this season )

But don't let that steer you away from a smarter robot. The pros greatly outweigh the cons. For example, auton becomes easy.

Good luck,
Jbot
__________________
Aren't signatures a bit outdated?
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
Programming - Getting Started Mark McLeod Programming 80 16-04-2008 23:37
White Paper Discuss: An Introduction to C Programming for First Robotics Applications CD47-Bot Extra Discussion 10 26-11-2004 21:54
White Paper Discuss: Official 2004 Introduction to Programming Guide CD47-Bot Extra Discussion 4 26-01-2004 20:59
control system programming archiver 2000 17 23-06-2002 22:14
Where can i Find info on the control programming Matchew General Forum 1 14-01-2002 19:09


All times are GMT -5. The time now is 21:00.

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