![]() |
Re: PID vs Bang-Bang for Shooter Consistency
Quote:
I was going to swing by Kennedy this evening, but now I get to spend the evening with her because it looks like you guys are going to be just fine!! Good luck in San Diego!! Quote:
As she stated, complicating Bang Bang is not necessary. It is actually a very simple controller IN THE RIGHT SITUATION. I believe the key to making it work is, a reliable way to measure the output being controlled. I still have a couple questions that will probably need to be answered by Mark McLeod, although you may know the answer to this Ether. How does the FPGA derive the "period" value? Is it just the time between rising, or falling, edges of a signal? Will the duty cycle of the signal influence the "period" value? |
Re: PID vs Bang-Bang for Shooter Consistency
Quote:
Additionally, the 40MHz clock is divided down by 261 to create a 153257 Hz (6.515 microsecond) polling frequency. The FPGA polls all the DIO inputs synchronously at this frequency. Whether the FPGA counts and timestamps rising edge only, or both rising and falling edges, or both rising and falling edges on both channels, is determined by how the user sets up the counter (or encoder) object. In encoder 4X mode, I believe FPGA counts both rising and falling edges on both channels, and by default computes the period using the 5 most-recent counts (i.e 4 periods). Then in WPILib, the period returned is divided by 4 to give the actual period between consecutive edges, which is the value returned to the caller. Quote:
|
Re: PID vs Bang-Bang for Shooter Consistency
Quote:
This is basically what I expected but I wanted to verify. The additional detail also helps whenever we will be using encoders, counters and timers. |
Re: PID vs Bang-Bang for Shooter Consistency
Quote:
|
Re: PID vs Bang-Bang for Shooter Consistency
Quote:
Not to mention we complicated our controller by using an equation to look up the approximate base power needed for the RPM we wanted, and then have it Add or subtract a certain amount from that based on whether we were over or under our setpoint. After all this fuss, it has become quite reliable though. |
Re: PID vs Bang-Bang for Shooter Consistency
Quote:
Averaging like that introduces phase lag in the sensor signal. Bang-bang does not like phase lag. What language were you using? Quote:
Quote:
|
Re: PID vs Bang-Bang for Shooter Consistency
Quote:
Quote:
Quote:
|
Re: PID vs Bang-Bang for Shooter Consistency
1 Attachment(s)
Here is our slightly modified code. With the minimum value being at 0, this caused a more inconsistent shooter since the wheel would turn off and on with too much of a difference between the two speeds. Therefore we changed 0 to -0.3.
(Keep in mind, our values are negative simply because this is how our code is written. This can be fixed in the Begin.vi if needed but this is working for us.) By changing the value to -0.3 it makes it impossible (based off of this code) to shoot below 30%. However, the Frisbee will barely go anywhere at that percentage anyway, therefore that number is perfect for us. Since the minimum value was changed to -0.3, this caused the wheel to spin at a constant speed of 30% if the desired RPMs were ever lower than that. Thus we added the =0 select value into the code to make sure that when we do not want the wheel to move, it doesn't. As for the rest of the code, it is the same as using a tachometer and the more basic code so graciously provided by billbo911. |
Re: PID vs Bang-Bang for Shooter Consistency
Quote:
If that doesn't fix the problem, continue: The code is not running fast enough. Take that waveform chart out of there and change the loop timing to 5ms and see if it fixes the problem. Quote:
|
Re: PID vs Bang-Bang for Shooter Consistency
I'm thinking the Break/Coast jumper is in the break is position.
|
Re: PID vs Bang-Bang for Shooter Consistency
Quote:
That wasn't even on my radar - I just assumed folks knew it should be coast. |
Re: PID vs Bang-Bang for Shooter Consistency
The jumper is in the coast position. We made sure as we were wiring the robot that it was put there.
Before we modified the code we had tried changing the 10ms to 1ms and it was way better, but still not as consistent as it is with the modification. It could just be the way that our bot is designed and programmed, but it works for us. |
Re: PID vs Bang-Bang for Shooter Consistency
Quote:
Quote:
|
Re: PID vs Bang-Bang for Shooter Consistency
So turn the robot on and leave it in disabled mode. Try turning your wheel by hand, then unplug one of the motor wires and try turning it by hand again. If it doesn't get easier to turn when you unplug a wire, then it's definitely in coast.
Also, if it's fairly hard to turn even with a wire unplugged, then you just have a lot of mechanical resistance in your system. That would also explain why you're seeing better stability with a -0.3 instead of 0. The extra mechanical resistance is slowing your wheel down more rapidly, so giving it a little push instead of letting it coast makes it ramp down slower. So you're having to bump it less often to keep it in tolerance, which I assume is what you're counting as better stability. |
Re: PID vs Bang-Bang for Shooter Consistency
Quote:
An ideal system for Bang Bang have very little resistance to rotation and a considerable amont of rotational inertia. Maybe Lori's solution is something to consider when using Bang Bang on a less than optimal system. This is deffinately something I would like to invetigate a bit more. |
| All times are GMT -5. The time now is 07:57. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi