Replace .to<double>() and .template to<double>() with .value() (#3667)

It's a less verbose way to do the same thing.
This commit is contained in:
Tyler Veness
2021-10-25 08:58:12 -07:00
committed by GitHub
parent 6bc1db44bc
commit 181723e573
134 changed files with 782 additions and 826 deletions

View File

@@ -94,7 +94,7 @@ class Robot : public frc::TimedRobot {
// Finally, we set our simulated encoder's readings and simulated battery
// voltage
m_encoderSim.SetDistance(m_armSim.GetAngle().to<double>());
m_encoderSim.SetDistance(m_armSim.GetAngle().value());
// SimBattery estimates loaded battery voltages
frc::sim::RoboRioSim::SetVInVoltage(
frc::sim::BatterySim::Calculate({m_armSim.GetCurrentDraw()}));
@@ -108,7 +108,7 @@ class Robot : public frc::TimedRobot {
// Here, we run PID control like normal, with a constant setpoint of 75
// degrees.
double pidOutput = m_controller.Calculate(
m_encoder.GetDistance(), (units::radian_t(75_deg)).to<double>());
m_encoder.GetDistance(), (units::radian_t(75_deg)).value());
m_motor.SetVoltage(units::volt_t(pidOutput));
} else {
// Otherwise, we disable the motor.