mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-19 00:41:43 +00:00
[examples] Replace M_PI with wpi::math::pi (#2938)
This commit is contained in:
@@ -9,6 +9,8 @@
|
||||
|
||||
#include <frc/Joystick.h>
|
||||
#include <frc/smartdashboard/SmartDashboard.h>
|
||||
#include <units/length.h>
|
||||
#include <wpi/math>
|
||||
|
||||
DriveTrain::DriveTrain() {
|
||||
// Encoders may measure differently in the real world and in
|
||||
@@ -20,11 +22,11 @@ DriveTrain::DriveTrain() {
|
||||
m_leftEncoder.SetDistancePerPulse(0.042);
|
||||
m_rightEncoder.SetDistancePerPulse(0.042);
|
||||
#else
|
||||
// Circumference in ft = 4in/12(in/ft)*PI
|
||||
m_leftEncoder.SetDistancePerPulse(static_cast<double>(4.0 / 12.0 * M_PI) /
|
||||
360.0);
|
||||
m_rightEncoder.SetDistancePerPulse(static_cast<double>(4.0 / 12.0 * M_PI) /
|
||||
360.0);
|
||||
// Circumference = diameter * pi. 360 tick simulated encoders.
|
||||
m_leftEncoder.SetDistancePerPulse(units::foot_t{4_in}.to<double>() *
|
||||
wpi::math::pi / 360.0);
|
||||
m_rightEncoder.SetDistancePerPulse(units::foot_t{4_in}.to<double>() *
|
||||
wpi::math::pi / 360.0);
|
||||
#endif
|
||||
SetName("DriveTrain");
|
||||
// Let's show everything on the LiveWindow
|
||||
|
||||
Reference in New Issue
Block a user