[wpilibc] Transition C++ classes to units::second_t (#3396)

A lot of these are breaking changes. frc::Timer was replaced with the
contents of frc2::Timer. The others were in-place argument changes or
removing deprecated non-unit overloads.
This commit is contained in:
Tyler Veness
2021-05-28 22:06:59 -07:00
committed by GitHub
parent 827b17a52b
commit e09293a15e
99 changed files with 503 additions and 790 deletions

View File

@@ -4,6 +4,8 @@
#include <algorithm>
#include <units/time.h>
#include "TestBench.h"
#include "frc/Encoder.h"
#include "frc/LinearFilter.h"
@@ -35,7 +37,7 @@ std::ostream& operator<<(std::ostream& os, MotorEncoderTestType const& type) {
return os;
}
static constexpr double kMotorTime = 0.5;
static constexpr auto kMotorTime = 0.5_s;
/**
* A fixture that includes a PWM motor controller and an encoder connected to
@@ -150,7 +152,7 @@ TEST_P(MotorEncoderTest, PositionPIDController) {
m_motorController->Set(std::clamp(speed, -0.2, 0.2));
}};
pidRunner.StartPeriodic(pidController.GetPeriod());
Wait(10.0);
Wait(10_s);
pidRunner.Stop();
RecordProperty("PIDError", pidController.GetPositionError());
@@ -177,7 +179,7 @@ TEST_P(MotorEncoderTest, VelocityPIDController) {
m_motorController->Set(std::clamp(speed, -0.3, 0.3));
}};
pidRunner.StartPeriodic(pidController.GetPeriod());
Wait(10.0);
Wait(10_s);
pidRunner.Stop();
RecordProperty("PIDError", pidController.GetPositionError());