[wpimath] PIDController: Add IZone (#5315)

Co-authored-by: Ryan Blue <ryanzblue@gmail.com>
This commit is contained in:
Gold856
2023-06-20 02:01:01 -04:00
committed by GitHub
parent f5b0d1484b
commit 991f4b0f62
7 changed files with 158 additions and 2 deletions

View File

@@ -49,3 +49,21 @@ TEST_F(PIDInputOutputTest, DerivativeGainOutput) {
EXPECT_DOUBLE_EQ(-10_ms / controller->GetPeriod(),
controller->Calculate(0.0025, 0));
}
TEST_F(PIDInputOutputTest, IZoneNoOutput) {
controller->SetI(1);
controller->SetIZone(1);
double out = controller->Calculate(2, 0);
EXPECT_DOUBLE_EQ(0, out);
}
TEST_F(PIDInputOutputTest, IZoneOutput) {
controller->SetI(1);
controller->SetIZone(1);
double out = controller->Calculate(1, 0);
EXPECT_DOUBLE_EQ(-1 * controller->GetPeriod().value(), out);
}