wpilibc: Add overloads for units (#1815)

Add unit-taking overloads to the following classes:
- IterativeRobotBase
- LinearFilter
- Notifier
- TimedRobot
- Timer (HasPeriodPassed only)
- frc2::PIDController

The corresponding non-units-taking functions have been deprecated.

The return value of TimedRobot::GetPeriod() was updated.
This is a breaking change, users should use to<double> to get the value in seconds.

Other return values, e.g. Timer::Get(), have NOT been updated due to much wider use.
This commit is contained in:
Prateek Machiraju
2019-08-17 00:56:48 -04:00
committed by Peter Johnson
parent f1d71da8a9
commit c07ac23532
15 changed files with 136 additions and 35 deletions

View File

@@ -57,7 +57,7 @@ TEST_F(PIDInputOutputTest, IntegralGainOutputTest) {
out = controller->Calculate(.025, 0);
}
EXPECT_DOUBLE_EQ(-.5 * controller->GetPeriod(), out);
EXPECT_DOUBLE_EQ(-.5 * controller->GetPeriod().to<double>(), out);
}
TEST_F(PIDInputOutputTest, DerivativeGainOutputTest) {
@@ -65,6 +65,6 @@ TEST_F(PIDInputOutputTest, DerivativeGainOutputTest) {
controller->Calculate(0, 0);
EXPECT_DOUBLE_EQ(-.01 / controller->GetPeriod(),
EXPECT_DOUBLE_EQ(-.01 / controller->GetPeriod().to<double>(),
controller->Calculate(.0025, 0));
}