Go to Post Legos rock! - Kyle Love [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 03-02-2008, 21:32
iamthewalrus135's Avatar
iamthewalrus135 iamthewalrus135 is offline
Joe Sanders
FRC #0294
 
Join Date: Jul 2007
Rookie Year: 2004
Location: Redondo
Posts: 1
iamthewalrus135 is an unknown quantity at this point
PID Troubleshooting

Just a question from a programmer having trouble with his PID loop- we are experimenting with our robot from last year since we don't the new one completely fabricated, and we're running into some problems.

The problem the other programmers and I have right now is that we can get our robot to turn 90 degrees (very reliably) but it does so in little spurts of motion. Our values are currently 120 of P, 1 of I, and 80 of D. We would prefer not to raise the Integral value too much because of the unpredictability.

Anybody know how we'd get it so we can turn 90 degrees in one smooth motion?

Thanks, Joe Sanders, FRC Team #294
  #2   Spotlight this post!  
Unread 03-02-2008, 21:36
Alan Anderson's Avatar
Alan Anderson Alan Anderson is offline
Software Architect
FRC #0045 (TechnoKats)
Team Role: Mentor
 
Join Date: Feb 2004
Rookie Year: 2004
Location: Kokomo, Indiana
Posts: 9,113
Alan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond repute
Re: PID Troubleshooting

If the turn stops way too soon, it sounds like your P constant is too low, and/or your D constant is much too high.
  #3   Spotlight this post!  
Unread 03-02-2008, 22:09
Joe Ross's Avatar Unsung FIRST Hero
Joe Ross Joe Ross is offline
Registered User
FRC #0330 (Beachbots)
Team Role: Engineer
 
Join Date: Jun 2001
Rookie Year: 1997
Location: Los Angeles, CA
Posts: 8,586
Joe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond repute
Re: PID Troubleshooting

It sounds like your D is too high, the robot starts accelerating and the D kicks in and slows it down too much, once it slows down, the D term decreases and it accelerates again.

One way to help debug your PID loop is to have the robot print all the appropriate data with commas delimiting the values. You can then use hyperterminal to capture the data to a file, and import it into excel to graph.
  #4   Spotlight this post!  
Unread 07-02-2008, 13:56
emersont49 emersont49 is offline
Mentor
#1098
 
Join Date: Sep 2004
Location: Fenton, Missouri
Posts: 34
emersont49 is a glorious beacon of lightemersont49 is a glorious beacon of lightemersont49 is a glorious beacon of lightemersont49 is a glorious beacon of lightemersont49 is a glorious beacon of lightemersont49 is a glorious beacon of light
Re: PID Troubleshooting

We are using a PID routine for our steering. We connect a pot to the steering gear motor for feedback.

We are calling our routine in Default_Routines and the behavior is somewhat erratic (we are working on the K values).

Should I call this in teleop_spin() and use the Get_ADC_Result_Count() value to determine if something has changed on the pot?

I'm afraid the 22.6 ms loop is too slow. Our steering system moves fairly fast.
__________________
Tim Emerson
  #5   Spotlight this post!  
Unread 07-02-2008, 14:16
Doug Leppard's Avatar
Doug Leppard Doug Leppard is offline
Registered User
FRC #1902 (Exploding Bacon)
Team Role: Engineer
 
Join Date: Apr 2003
Rookie Year: 2003
Location: Orlando
Posts: 435
Doug Leppard has a reputation beyond reputeDoug Leppard has a reputation beyond reputeDoug Leppard has a reputation beyond reputeDoug Leppard has a reputation beyond reputeDoug Leppard has a reputation beyond reputeDoug Leppard has a reputation beyond reputeDoug Leppard has a reputation beyond reputeDoug Leppard has a reputation beyond reputeDoug Leppard has a reputation beyond reputeDoug Leppard has a reputation beyond reputeDoug Leppard has a reputation beyond repute
Send a message via AIM to Doug Leppard
Re: PID Troubleshooting

We use PD of PID for the turn. We might add I later but it turns well now.

We use wheel encoders.

P = (left wheel count)*turnratio - right wheel encoder count

Turnratio = the ratio of the radius of the inside and outside turns. Smaller the ratio the larger the turns.

Then practice doing that with just P before you do move onto ID.

BTW to know when a turn is done, if you subtract one wheel count from the other it will give you the difference and that will give you the number of degrees no matter how large or small the turn is. For instance an 180 turn on our bot is about 600 encoder clicks diference between wheels or about 3.3 clicks per degree difference.
__________________
Doug Leppard
  #6   Spotlight this post!  
Unread 07-02-2008, 15:37
Alan Anderson's Avatar
Alan Anderson Alan Anderson is offline
Software Architect
FRC #0045 (TechnoKats)
Team Role: Mentor
 
Join Date: Feb 2004
Rookie Year: 2004
Location: Kokomo, Indiana
Posts: 9,113
Alan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond repute
Re: PID Troubleshooting

Quote:
Originally Posted by emersont49 View Post
I'm afraid the 22.6 ms loop is too slow. Our steering system moves fairly fast.
Keep in mind the fact that you can't change motor outputs any faster than the 26.2 millisecond loop anyway.
  #7   Spotlight this post!  
Unread 08-02-2008, 10:50
Mark McLeod's Avatar
Mark McLeod Mark McLeod is online now
Just Itinerant
AKA: Hey dad...Father...MARK
FRC #0358 (Robotic Eagles)
Team Role: Engineer
 
Join Date: Mar 2003
Rookie Year: 2002
Location: Hauppauge, Long Island, NY
Posts: 8,854
Mark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond repute
Re: PID Troubleshooting

Quote:
Originally Posted by Alan Anderson View Post
Keep in mind the fact that you can't change motor outputs any faster than the 26.2 millisecond loop anyway.
Not strictly true.
With proper code you can use PWMs 13-16 at the maximum 8ms update rate that the Victor's are designed to accomodate.
__________________
"Rationality is our distinguishing characteristic - it's what sets us apart from the beasts." - Aristotle
  #8   Spotlight this post!  
Unread 08-02-2008, 11:16
Alan Anderson's Avatar
Alan Anderson Alan Anderson is offline
Software Architect
FRC #0045 (TechnoKats)
Team Role: Mentor
 
Join Date: Feb 2004
Rookie Year: 2004
Location: Kokomo, Indiana
Posts: 9,113
Alan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond repute
Re: PID Troubleshooting

Quote:
Originally Posted by Mark McLeod View Post
With proper code you can use PWMs 13-16 at the maximum 8ms update rate that the Victor's are designed to accomodate.
Good point, thanks for mentioning it. And, fortunately for those teams whose programmers aren't experts on the guts of the PIC's CCP hardware, Kevin Watson has made most of that proper code available on his web site. With a little bit of custom code to set up a repeating timer, the deluxe PWM support functions can do great things.
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
Operator Interface Troubleshooting DavidGitz Control System 7 13-11-2007 14:02
Firefox troubleshooting. Madison IT / Communications 11 17-09-2006 01:28
PID Troubleshooting Disar Programming 4 13-09-2006 15:27
Troubleshooting - 783 lee87 Website Design/Showcase 2 13-02-2005 20:15
Troubleshooting System SilverStar Technical Discussion 0 23-01-2004 21:22


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

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