# Is Bang Bang Control a need when using shooter

Our team wants to ensures our shooter’s stability. l think that we will use a feedforward instead of velocity PID. l have searched this and found that a bang bang control is needed. After seeing WPI’s official explanation, l find that the bang bang controller mainly support two states, on and off. My puzzle is what’s the best mode of controlling a motor?

A properly tuned PID controller will result in a more consistent shooter speed than a bang bang. Due to bang bang only having two states, on and off, it will not smoothly stabilize on the point. Whether the error in the velocity is small or big, it only has one option of full blast or if the motor overshoots, it only has one option of shutting the entire thing off.

Compare that to a P controller, where the change in motor velocity is proportional to the error. If the error is large, the P controller will result in a large correction, and if the error is small, the motor will do a small correction. This is much smoother than bang bang as the PID can “find the right velocity to run at” while a bang bang can only rapidly change between on and off. The I and D terms are not necessary for a shooter wheel and can be difficult to tune if you don’t know what you are doing.

Tuning the P constant is fairly simple. If the shooter is slow to change speeds, P is too low and needs to be increased. If the shooter oscillates a lot or behaves erratically (you can see this in graphs and hear it from the shooter motor), P is too high and needs to be reduced.

Is a kF needed? And is feedforward needed?

A properly tuned feedforward constant will help the shooter wheel get up to speed. For a shooter, all it really is an approximately constant value that will be added to the controller. When tuning the kf, the kf alone should never get above the lowest speed you plan on running the shooter at.

Also, if you are running a falcon motor for the shooter, I would suggest using the falcon PID controller.

Bang-bang control is equivalent to maximally-aggressive proportional control under an asymmetrical output constraint (this helps make the extremely aggressive approach tolerable in terms of oscillation). It works really well if you have enough inertia and you’re running the control loop fast enough. It does result in some oscillation at steady-state; that’s the price you pay for minimizing recovery time. Often, the oscillation is small enough not to matter.

This is only true if you’re using an asymmetrical controller, and even then “the lowest speed you plan on running the shooter at” isn’t a good way to put it - rather, the feedforward should be small enough to ensure that the steady-state error of the feedforward response is negative at all setpoints (but no smaller).

I’d suggest this as well, but I’d turn it into a bang-bang controller by setting the proportional gain to positive infinity and using the max output settings to enforce the asymmetry. You should also be sure to modify the velocity filtering settings per the instructions in the CTRE

documentation.

At least for a low inetria shooter system for this game, oscillation around the setpoint would be worse than a marginally slower recovery time as the shooter is able to recover way faster than the second shot can reasonably made without hitting the first shot.

I wouldn’t presume to know a team’s shooter setup.

You were suggesting to use bang bang if their shooter is high inertia shooter which is generally not run this year.

Depends on how long the ball is in contact with the shooter wheel and how much compression is used, too.

I know a couple teams who have gotten bang-bang working well on their shooters this year. The OP should try it and see what happens (or maybe characterize the mechanism with sysid and compare the time constant to the loop rate to see if it’s feasible).

How would one use sysid to determine whether bangbang is feasible?

There’s no hard and fast rule but a decent heuristic is that the loop period should be at least 10x faster than the system time constant.

1 Like

What are those? I know they’re things in SysId but what do they actually mean/do in a physical system?

The time constant is the amount of time it takes the motor to reach `1 - 1/e` (~63%) of its steady-state velocity. The loop period is the time between PID loop iterations.

1 Like

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.