# Falcon PID Problems

Hey guys. We are trying to PID tune two falcons to keep a constant speed while running. However, when we activate the PID, instead of trying to keep the constant speed, it varies between 0 and the speed that we want it to be at, eventually tapering off to 0. Any help would be appreciated.

Can you post your code? Are you making on falcon follow another? What PID values are you using?

So, the Falcons are following each other, and we have P as 0, I as 0, and D as 0

You must experimentally determine what constants work best for you. However, i can safely say that having all 3 set to 0 accomplishes nothing. A good starting point is to set P to a small value (say 0.3) and go from there. Usually P alone is sufficient.

FRC Programming done right has a good section on PID. Also, PID seems Overkill for maintaining constant speed. Are you sure that’s what you meant?

Yeah, its what I mean. Our shooter works fine without PID, but the speed drops after we shoot a ball. Our mentors want the speed drops to be smaller, so we are trying to use PID. What I don’t understand is why the Motor fluctuates between 0 and the speed that we want instead of staying at the speed that we want and then correcting.

For example, we want the falcon output to be 0.85. When we run the shooter without PID, we keep a constant speed of 0.85 until we shoot, then it falls. With PID active, the motor fluctuates between 0 and 0.85, no inbetween power, so the wheels never actually reach 0.85 output.

It sounds like you’re not using an input sensor. For example an encoder to read the shooter rpm.
A PID will give you the the motor power required to reach the target rpm using the current rpm read from the encoder.

Check out https://frc-pdr.readthedocs.io/en/latest/control/pid_control.html for more detail.

I think this is because you have P set to 0. Try it again with a small, positive, constant.

How would we use an input sensor?

Youmay have to implement the input interface yourself. It should have a single method. Create an implementation (perhaps the class with the falcons itself) that returns the shooter’s speed

This is one of the things that a PID loop for velocity control is perfect for.

The falcons have a built in encoder and a built in velocity control mode that uses the PID values so there’s a lot that you just have to configure and it will just work.

This thread has some good information on uses a velocity control loop for PID

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