Go to Post RoboRIO brownout (v, n): The GDC's alternative to limiting the number of motors allowed on a robot. - GeeTwo [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 Rating: Thread Rating: 2 votes, 5.00 average. Display Modes
  #1   Spotlight this post!  
Unread 25-03-2009, 18:16
ericbarch's Avatar
ericbarch ericbarch is offline
221 Robotic Systems Engineer
FRC #0027 (Team Rush)
Team Role: Mentor
 
Join Date: Jan 2008
Rookie Year: 2007
Location: Clarkston, MI
Posts: 15
ericbarch is a jewel in the roughericbarch is a jewel in the roughericbarch is a jewel in the roughericbarch is a jewel in the rough
Send a message via AIM to ericbarch
PID on a one directional Shooter

Just wondering if anyone has a good solution for pulling off some sort of PID on some shooter wheels that can only spin one direction. We're using encoder feedback to get the current speed of the shooter wheels and we have setpoints for how fast we want them to be spinning.

The issue is that the error is so far off that the shooter wheels spin up very fast and overshoot (even with an extremely low P and no I/D). We had to set the motor power so that if the PID sends a value less than 0, that it's set to 0. What we're experiencing is the motor power going between full on and full off.

Any ideas would be greatly appreciated. Thanks!
__________________
Eric Barch
221 Robotic Systems
Controls Engineer
http://team221.com
  #2   Spotlight this post!  
Unread 25-03-2009, 18:35
KevinReid's Avatar
KevinReid KevinReid is offline
Registered User
FRC #2609 (Beaver worX)
Team Role: Mentor
 
Join Date: Feb 2008
Rookie Year: 2008
Location: Guelph
Posts: 48
KevinReid is a splendid one to beholdKevinReid is a splendid one to beholdKevinReid is a splendid one to beholdKevinReid is a splendid one to beholdKevinReid is a splendid one to beholdKevinReid is a splendid one to beholdKevinReid is a splendid one to behold
Re: PID on a one directional Shooter

Are you using Labview? If so, the PID block uses a coerce block to set upper/lower limits. Instead of using 0 and 1 for limits in the pid block, use 0 and 100, then divide the pid result by 100.
__________________
  #3   Spotlight this post!  
Unread 25-03-2009, 18:51
Mike Soukup's Avatar
Mike Soukup Mike Soukup is offline
Software guy
FRC #0111 (Wildstang)
Team Role: Engineer
 
Join Date: May 2001
Rookie Year: 1996
Location: Schaumburg, IL
Posts: 797
Mike Soukup has a reputation beyond reputeMike Soukup has a reputation beyond reputeMike Soukup has a reputation beyond reputeMike Soukup has a reputation beyond reputeMike Soukup has a reputation beyond reputeMike Soukup has a reputation beyond reputeMike Soukup has a reputation beyond reputeMike Soukup has a reputation beyond reputeMike Soukup has a reputation beyond reputeMike Soukup has a reputation beyond reputeMike Soukup has a reputation beyond repute
Re: PID on a one directional Shooter

Your problem is similar to what we implemented in 2006 for our shooter wheel. From your description, it sounds like the error you're using for PID is the speed difference and the result of the PID calculation is sent directly to the speed controller. This isn't what you want to do.

The way to accomplish this is to get a PWM value that typically gives you the correct steady state shooter speed, or close enough to it. Then use the speed difference as the error in your PID calculation. Now use the PID result not as your absolute PWM value, but instead add it to the typical steady state PWM value. This way if you're going too slow, you'll get an extra boost of power and if you're going too fast, you'll decrease power slightly instead of shutting the motor off or running it in reverse.

For example, through experimentation you learn that a PWM value of .7 usually gives you a shooter speed of 1000 RPM when there are no balls running through it. Run PID on the difference between your current shooter speed and 1000. Add the result of the PID calculation to .7 and set your speed controller to that value.

The PID calculation should not give you huge numbers, but the steady state PWM value + the maximum PID result you see should be enough to give you full power on the speed controller.
  #4   Spotlight this post!  
Unread 25-03-2009, 21:12
dnguyen3725 dnguyen3725 is offline
Engineering Mentor
FRC #0687 (Nerd Herd)
Team Role: Mentor
 
Join Date: Mar 2009
Rookie Year: 1999
Location: Manhattan Beach, CA
Posts: 1
dnguyen3725 is an unknown quantity at this point
Send a message via AIM to dnguyen3725
Re: PID on a one directional Shooter

If your controller is overshooting your setpoint as you are describing then you could have an underdamped system. You can add some damping by implementing D control. To understand why, you can think about your system as a free swinging frictionless pendulum. With no damping, the pendulum will continuously swing and will settle on a set point. If you add a little damping (e.g. friction) the pendulum will eventually settle on a point. Add enough friction and the pendulum will swing directly to a point without overshooting at all. You can think of D control like adding virtual friction to your system. You'll notice that the equation for D control and the equation for friction are the same with your D gain equivalent to the coefficient of friction.

However, unless you have a relatively heavy wheel with low friction bearings I would suspect that the mechanical system itself has enough damping to prevent the kind of rail to rail oscillation that you are referring to. I would guess that P control is sufficient. When you say "extremely low" for your P gain, what do you mean? How "high" or "low" this value is would depend on the units you are using for your inputs and outputs. Don't be afraid to set this value even lower. I believe my students tuned our robot's shooter with a P gain in the 1e-5 range.

I hope this is helpful.
  #5   Spotlight this post!  
Unread 25-03-2009, 23:11
gwytheyrn gwytheyrn is offline
Registered User
AKA: David
FRC #0461 (West Side Boiler Invasion)
Team Role: Programmer
 
Join Date: Dec 2007
Rookie Year: 2004
Location: Indiana
Posts: 44
gwytheyrn is infamous around these parts
Send a message via AIM to gwytheyrn
Re: PID on a one directional Shooter

Okay, so here's what I did.
1. I made my own encoder rate counter using a timed 30ms loop and a feedback node to find the rate/30ms. This was done because the rate function in the get encoder vi put out too large a number and was pretty unstable (could range 40%).
2. Scale above rate to 0->1. 1 is max speed.
3. Using a customized PID controller (Using only the I term...maybe a little P), I can now control the wheel rate. Unfortunately, I had to set the I term a little high to prevent stalling, so there is a suboptimal amount of oscillation and overshoot, but it doesn't take that long to settle, so it's okay. I have the I term reset whenever the target speed is 0. My loop runs every 30ms, but I can't remember my gains right now. (make sure you limit your I term and stuff...Another note, the PID controller in LV has a really strange way of doing I and D...doesn't use kI and kD, it uses like ti td...)

Using this method, you don't have to know a "nominal" PWM value because it finds it for you. I suggest not going with a pure P, since it'll slow down the closer it gets to the setpoint until settles between the initial and set points. I may/may not be able to get around to posting an example, so if you want it, just ask. (We use LV, so if you're looking for C++, I can't provide an example, but the theory remains the same).

Last edited by gwytheyrn : 26-03-2009 at 00:09. Reason: add extra note
  #6   Spotlight this post!  
Unread 26-03-2009, 00:12
Uberbots's Avatar
Uberbots Uberbots is offline
Mad Programmer
AKA: Billy Sisson
FRC #1124 (ÜberBots)
Team Role: College Student
 
Join Date: Jan 2006
Rookie Year: 2005
Location: Avon
Posts: 739
Uberbots has a reputation beyond reputeUberbots has a reputation beyond reputeUberbots has a reputation beyond reputeUberbots has a reputation beyond reputeUberbots has a reputation beyond reputeUberbots has a reputation beyond reputeUberbots has a reputation beyond reputeUberbots has a reputation beyond reputeUberbots has a reputation beyond reputeUberbots has a reputation beyond reputeUberbots has a reputation beyond repute
Re: PID on a one directional Shooter

labview's PID controller is a little weird... first off set the limits to +/- 100 (for some reason this is neccesary), and scale that to the motor output (1.27x + 127)

you might want to graph the PV and PID output for this part...

secondly, push up the P gain until you get a limit cycle on the velocity (when the velocity jumps back and forth between the setpoint with about equal amplitude)
thirdly, give it small amounts of D until you see the PV settle out quickly to the setpoint when you change it/jump it.

fourthly, if it appears to never quite get to the setpoint (shouldnt happen often in a velocity controller with low load), give it some I until it appears to compensate.
Thats my [unofficial] method of tuning these PID loops... its not the right way but it works for me almost every time.

Also, if you are trying to tune with kP, kI and kD (not labview's kP, Ti, Td), keep the following in mind:
kP = kP
kI proportional to kP/Ti
Kd proportional to kP * Td
__________________
A few of my favorite numbers:
175 176 177 195 230 558 716 1024 1071 1592 1784 1816
RPI 2012
BREAKAWAY

Last edited by Uberbots : 26-03-2009 at 00:13. Reason: engrish
  #7   Spotlight this post!  
Unread 26-03-2009, 13:15
Adam Y.'s Avatar
Adam Y. Adam Y. is offline
Adam Y.
no team (?????)
 
Join Date: Mar 2002
Location: Long Island
Posts: 1,979
Adam Y. is a splendid one to beholdAdam Y. is a splendid one to beholdAdam Y. is a splendid one to beholdAdam Y. is a splendid one to beholdAdam Y. is a splendid one to beholdAdam Y. is a splendid one to beholdAdam Y. is a splendid one to behold
Send a message via AIM to Adam Y.
Re: PID on a one directional Shooter

Quote:
Originally Posted by Uberbots View Post
fourthly, if it appears to never quite get to the setpoint (shouldnt happen often in a velocity controller with low load), give it some I until it appears to compensate.
Thats my [unofficial] method of tuning these PID loops...
Depending on how you build any PID controller you may or may not get the steady state to the setpoint. Mathematically, your steady state error depends on the number of integrals and the input function.
__________________
If either a public officer or any one else saw a person attempting to cross a bridge which had been ascertained to be unsafe, and there were no time to warn him of his danger, they might seize him and turn him back without any real infringement of his liberty; for liberty consists in doing what one desires, and he does not desire to fall into the river. -Mill
  #8   Spotlight this post!  
Unread 27-03-2009, 00:09
Robostang 548's Avatar
Robostang 548 Robostang 548 is offline
I can program the future...
AKA: Don
FRC #0548 (Robostangs)
Team Role: Programmer
 
Join Date: Jan 2007
Rookie Year: 2006
Location: Northville Mi
Posts: 69
Robostang 548 is on a distinguished road
Send a message via AIM to Robostang 548 Send a message via MSN to Robostang 548 Send a message via Yahoo to Robostang 548
Re: PID on a one directional Shooter

We had to implement such a PID system for our shooter. I kind of accidently stumbled upon the solution. I first collected some data points for what motor power corresponded to what shooter RPM. I graphed them in a spreadsheet program and got out a power equation to use in my program. We are using NI LabView. The program sets an rpm for the shooter then runs it through the equation. This puts out a power to send to the motor that is mostly accurate but off by some (due to low battery, friction, etc). The output of this equation is then multiplied by one 1 + the output of our PID block. The PID has a range of -.5 to .5 and uses the difference between desired and actual speed as the process variable. The setpoint is a constant representing zero error. Based on this, its able to increase/decrease the power of the base equation by up to 50% by generating this coefficient. I then just played around while running the vi on my computer till I couldn't hear the sound of the wheel adjusting for the set speed. This system keeps the average error at about 2% and no greater than 10%. As for our PID values, we are not using the D term at all, an extremely low proportional value, and .028 for our integral value (of course, these are things you'll need to adjust for your own shooter). I hope this bit of info helped, and good luck!

-Don Ebben
__________________

Team 548:
Attending National Championship, Genesee District, Detroit District 2, West Michigan District, Michigan Championship?


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
Driving omni-directional wheels VanZuiden General Forum 4 19-01-2006 22:59
One or Two Wheel Shooter Nitroxextreme Technical Discussion 6 14-01-2006 01:10
Bi-directional ratchet need help Xufer Technical Discussion 13 31-01-2005 14:27
Omni Directional Wheels Will Seymour General Forum 3 11-01-2003 12:43


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

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