Thread: Tuning PID Code
View Single Post
  #8   Spotlight this post!  
Unread 15-02-2006, 08:12
Chris_Elston's Avatar
Chris_Elston Chris_Elston is offline
Controls Engineer
AKA: chakorules
FRC #1501 (Team THRUST)
Team Role: Engineer
 
Join Date: Feb 2004
Rookie Year: 2001
Location: Huntington, Indiana
Posts: 750
Chris_Elston has a reputation beyond reputeChris_Elston has a reputation beyond reputeChris_Elston has a reputation beyond reputeChris_Elston has a reputation beyond reputeChris_Elston has a reputation beyond reputeChris_Elston has a reputation beyond reputeChris_Elston has a reputation beyond reputeChris_Elston has a reputation beyond reputeChris_Elston has a reputation beyond reputeChris_Elston has a reputation beyond reputeChris_Elston has a reputation beyond repute
Re: Tuning PID Code

I won't go in the method of tuning a PID as others have done, but here are some tips to get you up in running FAST.

1. Use three POTs on a board labeling them P,I,D. Connect them to Analog ports. Say 14,15,16 respectfully. Make a function to read the pots, and then multiply the values out. Like K_P = analog14 * 0.0001. Of course K_P needs to be a float.

Your analog will be 0-1024 so you need to make your K_P, K_I, K_D values smaller, normally less than 1

K_P = analog14 * 0.0001
K_I = analog15 * 0.0001
K_D = analog16 * 0.0001

If you need a bigger "tweak" just shrink the multiplier

K_P = analog14 * 0.001
K_I = analog15 * 0.001
K_D = analog16 * 0.001

You won't be able to view K_P in your "Print to Screen" so just display your analog value, so you can multiply or divide back to get your "real" K_P,K_I,orK_D value to "hard code" it back into the system so you can REMOVE the PID trimmer pot board.


2. Wow...use LABVIEW to tune your PID system. We tuned our ball velocity PID by connecting the ball motor to PWM1, then mapped our velocity variable to PWM2. Start Labview Dashboard. Both applications, the connections one, and the view application. Of course there ARE NO MOTORS connected to PWM2, we are just transporting the information to Labview because we don't know how to edit Labview. Out of the box, PWM1 and PWM2 was configured in a graph......;-)

See these handy video tutorials if you haven't done it yet.
http://www.lasarobotics.org/Forum/viewtopic.php?t=366

Now you can view your PWM1 which is your motor OUTPUT, and your pretending that PWM2 is your velocity output so you can just use Labview PWM2 to view, graph and log your PID tuning. You'll see very quickly how effective this tool is.

In combination of the two tools, making a PID tuning POT trimmer board, and displaying the tune on Labview, you'll have your PID tuning done in a matter of minutes.

Hopfully this helps.




-
__________________
Team T.H.R.U.S.T. 1501
Download all of our past robot's source code here:Repository

Favorite CD quote:
"That can't be their 'bot. not nearly enough (if any) rivets to be a 1501 machine." ~RogerR: Team #1369

Last edited by Chris_Elston : 15-02-2006 at 08:16.