mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-20 00:51:42 +00:00
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:
@@ -12,9 +12,9 @@ TurnToAngle::TurnToAngle(units::degree_t target, DriveSubsystem* drive)
|
||||
: CommandHelper(
|
||||
frc2::PIDController(kTurnP, kTurnI, kTurnD),
|
||||
// Close loop on heading
|
||||
[drive] { return drive->GetHeading().to<double>(); },
|
||||
[drive] { return drive->GetHeading().value(); },
|
||||
// Set reference to target
|
||||
target.to<double>(),
|
||||
target.value(),
|
||||
// Pipe output to turn robot
|
||||
[drive](double output) { drive->ArcadeDrive(0, output); },
|
||||
// Require the drive
|
||||
@@ -24,8 +24,7 @@ TurnToAngle::TurnToAngle(units::degree_t target, DriveSubsystem* drive)
|
||||
// Set the controller tolerance - the delta tolerance ensures the robot is
|
||||
// stationary at the setpoint before it is considered as having reached the
|
||||
// reference
|
||||
m_controller.SetTolerance(kTurnTolerance.to<double>(),
|
||||
kTurnRateTolerance.to<double>());
|
||||
m_controller.SetTolerance(kTurnTolerance.value(), kTurnRateTolerance.value());
|
||||
|
||||
AddRequirements({drive});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user