PID Loop Constants

I was browsing through the WPILib guide on PID Subsystems and I came upon this sample code:

public class Wrist extends PIDSubsystem { // This system extends PIDSubsystem

Victor motor = RobotMap.wristMotor;
AnalogInput pot = RobotMap.wristPot();

public Wrist() {
	super("Wrist", 2.0, 0.0, 0.0);// The constructor passes a name for the subsystem and the P, I and D constants that are used when computing the motor output
	setAbsoluteTolerance(0.05);
	getPIDController().setContinuous(false);
}

I’m not sure why the code is setting the I and D constants to 0. Is it to only make it a P loop? Are there any benefits of using only P over PID?

You are correct, setting the I and D constants to zero makes it a P controller rather than a PID controller.

To answer your question, sometimes a P loop is all that is needed to get the system behaving the way you need it(although usually at least the D constant is also required in FRC robots). It’s important to note that when you are tuning a PID controller, you typically start with the P value and leave the I and D at 0. For more information about tuning a PID controller, I’d recommend this Wikipedia article as a starting point. It’s not the only way to tune a PID controller by any means, but it is the most widely used.

Great, thanks so much!