[wpimath] PIDController: Update field and method names for error and errorDerivative (#7088)

This commit is contained in:
Nicholas Armstrong
2024-09-23 13:57:20 -04:00
committed by GitHub
parent 64e5e6db59
commit 6281ec0810
9 changed files with 192 additions and 91 deletions

View File

@@ -36,28 +36,28 @@ class PIDToleranceTest {
assertFalse(
controller.atSetpoint(),
"Error was in tolerance when it should not have been. Error was "
+ controller.getPositionError());
+ controller.getError());
controller.calculate(0.0);
assertFalse(
controller.atSetpoint(),
"Error was in tolerance when it should not have been. Error was "
+ controller.getPositionError());
+ controller.getError());
controller.calculate(kSetpoint + kTolerance / 2);
assertTrue(
controller.atSetpoint(),
"Error was not in tolerance when it should have been. Error was "
+ controller.getPositionError());
+ controller.getError());
controller.calculate(kSetpoint + 10 * kTolerance);
assertFalse(
controller.atSetpoint(),
"Error was in tolerance when it should not have been. Error was "
+ controller.getPositionError());
+ controller.getError());
}
}
}

View File

@@ -28,23 +28,23 @@ TEST(PIDToleranceTest, AbsoluteTolerance) {
EXPECT_FALSE(controller.AtSetpoint())
<< "Error was in tolerance when it should not have been. Error was "
<< controller.GetPositionError();
<< controller.GetError();
controller.Calculate(0.0);
EXPECT_FALSE(controller.AtSetpoint())
<< "Error was in tolerance when it should not have been. Error was "
<< controller.GetPositionError();
<< controller.GetError();
controller.Calculate(kSetpoint + kTolerance / 2);
EXPECT_TRUE(controller.AtSetpoint())
<< "Error was not in tolerance when it should have been. Error was "
<< controller.GetPositionError();
<< controller.GetError();
controller.Calculate(kSetpoint + 10 * kTolerance);
EXPECT_FALSE(controller.AtSetpoint())
<< "Error was in tolerance when it should not have been. Error was "
<< controller.GetPositionError();
<< controller.GetError();
}