[examples] Replace M_PI with wpi::math::pi (#2938)

This commit is contained in:
Tyler Veness
2020-12-17 00:15:02 -08:00
committed by GitHub
parent b27d33675d
commit 4afb13f98b
4 changed files with 18 additions and 16 deletions

View File

@@ -51,7 +51,7 @@ public class DriveTrain extends SubsystemBase {
m_leftEncoder.setDistancePerPulse(0.042);
m_rightEncoder.setDistancePerPulse(0.042);
} else {
// Circumference in ft = 4in/12(in/ft)*PI
// Circumference = diameter in feet * pi. 360 tick simulated encoders.
m_leftEncoder.setDistancePerPulse((4.0 / 12.0 * Math.PI) / 360.0);
m_rightEncoder.setDistancePerPulse((4.0 / 12.0 * Math.PI) / 360.0);
}

View File

@@ -1,5 +1,5 @@
/*----------------------------------------------------------------------------*/
/* Copyright (c) 2017-2019 FIRST. All Rights Reserved. */
/* Copyright (c) 2017-2020 FIRST. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */
/* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */
@@ -61,7 +61,7 @@ public class DriveTrain extends Subsystem {
m_rightEncoder.setDistancePerPulse(0.0785398);
m_leftEncoder.setDistancePerPulse(0.0785398);
} else {
// Convert to feet 4in diameter wheels with 360 tick sim encoders
// Circumference = diameter in feet * pi. 360 tick simulated encoders.
m_rightEncoder.setDistancePerPulse(
(4.0/* in */ * Math.PI) / (360.0 * 12.0/* in/ft */));
m_leftEncoder.setDistancePerPulse(