means that calling enableContinousInput(0,360) will force the error term to be in that range. As a result it will always be positive, and when it should be small and negative it will be very large and positive. Needless to say, the resulting controller will not be very effective and could actually be dangerous.
To Reproduce
Steps to reproduce the behavior:
PIDController c = new PIDController(1, 0, 0);
c.enableContinousInput(0,360);
c.setSetpoint(359);
double output = c.calculate(1);
Expected behavior
output should be -2, not 358.
Note that all existing examples and tests call enableContinuousInput(-180,180) or enableContinuousInput(-pi,pi) and those will work properly.
Describe the bug This line:
https://github.com/wpilibsuite/allwpilib/blob/f57c188f2e3d0e9cf0de80e2a1cbb76f10a3e8fa/wpilibj/src/main/java/edu/wpi/first/wpilibj/controller/PIDController.java#L207
means that calling
enableContinousInput(0,360)
will force the error term to be in that range. As a result it will always be positive, and when it should be small and negative it will be very large and positive. Needless to say, the resulting controller will not be very effective and could actually be dangerous.To Reproduce Steps to reproduce the behavior:
Expected behavior output should be -2, not 358.
Note that all existing examples and tests call
enableContinuousInput(-180,180)
orenableContinuousInput(-pi,pi)
and those will work properly.