|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools |
Rating:
|
Display Modes |
|
|
|
#1
|
|||
|
|||
|
PID vs Bang-Bang for Shooter Consistency
Currently our team is having problems with shooter consistency. Both PID and Bang-Bang have yielded negative results for us.
We are using a photoswitch (provided in 2011 KoP) in place of an encoder... With PID programming, we used the counter and wired it into a PID function and attached the output to the motor. However, according to the gains we test, the wheel will either not move, jerk back and forth, or spin at full power. Thus far, we have never been able to get PID to work. With the Bang-Bang theory, we used the example provided by Billbo911 located at http://www.chiefdelphi.com/media/papers/2665. We have 1 stripe on our wheel and thus the numbers on the example were indeed changed from 360 to 1. So that is not the problem. When tested, the wheel would either not do anything or would spin at full power. We have gone through the thread http://www.chiefdelphi.com/forums/sh...d.php?t=113029. The modified code in there has been tested as well and that seemed to yield some results. The wheel would spin according to the number that was put in, however, the shots we fired were not very consistent. Therefore that leads us to believe that the code was not working for us. Ultimately, our goal is to make our frisbee shots consistent. We have researched a lot on this idea and not much seems to be working for us. Additionally, the idea has been brought up that I might as well ask here; is it reasonable to use battery voltage as a factor and create a wheel speed equation that consistently maintains the desired speed by taking battery power into the equation? Bottom line is how can we get a consistent shooter if neither PID nor Bang-Bang theory is working for us? And if there is no other option, why is our code not working? If anyone could help out on this that would be great! |
|
#2
|
|||
|
|||
|
Re: PID vs Bang-Bang for Shooter Consistency
One thing that may help is to post some data. It is pretty straightforward to add indicators that chart the sensor value over time and on the same plot you can add in the output value. This helps people spot many common issues from noisy sensor to feedback to programming errors. Then take a screenshot of the chart and post it here.
Greg McKaskle Last edited by Greg McKaskle : 25-02-2013 at 19:37. Reason: Closing sentence |
|
#3
|
|||
|
|||
|
Re: PID vs Bang-Bang for Shooter Consistency
Quote:
|
|
#4
|
|||
|
|||
|
Re: PID vs Bang-Bang for Shooter Consistency
Your choice. The bang-bang may provide the most informative.
Greg McKaskle |
|
#5
|
|||||
|
|||||
|
Re: PID vs Bang-Bang for Shooter Consistency
Not in my FRC boot, so I can't check, but does the Labview PID VI have a feedforward term and integral anti-windup? Both of those are really necessary to get good performance from a PID loop on a shooter.
Also, you say you're using a Counter and you said you changed from using 360 to 1. Are you using the counts from the Counter, or are you using the period? The single count encoder trick only really works if you're using the period from the Counter. You don't get nearly enough of those single counts to do any kind of control. So instead, you use 60/period which gives you a fairly accurate measure of RPMs. That should be your input to your PID or Bang-Bang. |
|
#6
|
||||||||
|
||||||||
|
Re: PID vs Bang-Bang for Shooter Consistency
Quote:
Quote:
With a low count-per-rev sensor, you want to use the 2nd method, not the first. Post a screenshot of your code so we can see if you are using the correct method. Quote:
Quote:
Quote:
Quote:
Quote:
Quote:
Additional information needed: 1) What motor(s) are you using, what is the total gear ration from each motor to each wheel, what motor controllers are you using. 2) What speed are you trying to control at? 3) The graphs Mark requested would be a good idea Last edited by Ether : 25-02-2013 at 23:50. |
|
#7
|
||||
|
||||
|
Re: PID vs Bang-Bang for Shooter Consistency
Hi Lori,
Check your e-mail. I just sent you a customized version of the Bang-Bang. I'll post the content here for others to see as well. Kennedy is using a single count per rev. "encoder". This encoding works best with measuring the period and converting to RPM than measuring counts during a given period and then converting to RPM. Once the measured RPM is established, controlling the RPM becomes a simple matter of comparing the actual RPM to the desired and turning the speed controller on or off. Note in the attached image, the point where the value is obtained from the "Counter Get" is the period output. Additionally, if this method is followed exactly, it is only capably of tracking RPM up to a theoretical maximum of 6000 RPM. But, that is perfect for use with a direct drive CIM powered shooter. |
|
#8
|
|||
|
|||
|
Re: PID vs Bang-Bang for Shooter Consistency
@billbo911 Great! Based off of what Kevin said I revised the code to use the period. I knew I was doing something wrong in the program I just wasn't sure what. So the problems we are having is mostly based off of the fact that is a single count "encoder" and the program does not work for that?
|
|
#9
|
|||||
|
|||||
|
Re: PID vs Bang-Bang for Shooter Consistency
Quote:
I'm pretty sure that will work for higher RPM unless Labview is somehow mangling the period output and WPILib isn't. We use C++ and I'm doing essentially the same thing on our small wheel shooter and I'm measuring up to 11,000 RPM. Why do you think that's limited to 6000 RPM? |
|
#10
|
||||
|
||||
|
Re: PID vs Bang-Bang for Shooter Consistency
Quote:
If there's a high-speed limit, it would be in the sensor itself. That's why I asked him to post a picture of the wheel with the tape on it. If the tape doesn't cover a sufficient angle of arc, at high speeds the pulse width may be too small for the sensor to detect reliably. |
|
#11
|
|||||
|
|||||
|
Re: PID vs Bang-Bang for Shooter Consistency
Quote:
Quote:
![]() Quote:
Quote:
Quote:
a) We are using a CIM motor with a direct drive between the wheel and the motor. The motor is controlled by a talon. b) We are aiming for any and all speeds c) Graphs coming soon (when I can get back to the robot again )The code thus far is attached! |
|
#12
|
|||||
|
|||||
|
Re: PID vs Bang-Bang for Shooter Consistency
Quote:
Quote:
Quote:
Quote:
|
|
#13
|
||||
|
||||
|
Re: PID vs Bang-Bang for Shooter Consistency
Kein and Ether,
If you take a look at the example I posted, it has a 10ms "wait". I based my comment on 60sec/.010 sec = 6000. I realize now that the FPGA will return the latest sample, or period, regardless of how often it is called for. Thus my number is probably way off and 11K RPM number is more reasonable. Good to know. |
|
#14
|
|||
|
|||
|
Re: PID vs Bang-Bang for Shooter Consistency
Quote:
We tested the code that billbo911 posted and it worked! With a few very minor adjustments we got it to work specifically for our robot perfectly. I pulled up a graph of the speed and output and it was very consistent. I think our problem this whole time has just been the fact that we were making it too complicated. In addition, when I was first looking into the bang-bang theory I did not understand it all that well but this really clears it up. Thanks everyone for taking the time to help out with this! It really helps our team out. Last edited by lori558 : 26-02-2013 at 14:58. |
|
#15
|
||||
|
||||
|
Re: PID vs Bang-Bang for Shooter Consistency
Bill has posted various versions using different decoding methods. For the benefit of readers of this thread, could you please post the final code that worked for you? Please include both the "begin" and "TeleOp" portions.
Quote:
Quote:
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|