[wpiutil] Deprecate wpi::math constants in favor of wpi::numbers (#3383)

The constants were moved from std::math to std::numbers before
ratification in C++20.
This commit is contained in:
Tyler Veness
2021-05-26 00:09:36 -07:00
committed by GitHub
parent 393bf23c0c
commit a238cec12b
73 changed files with 322 additions and 284 deletions

View File

@@ -5,7 +5,7 @@
#include "commands/TurnDegrees.h"
#include <units/math.h>
#include <wpi/math>
#include <wpi/numbers>
void TurnDegrees::Initialize() {
// Set motors to stop, read encoder values for starting point
@@ -26,7 +26,7 @@ bool TurnDegrees::IsFinished() {
// found here https://www.pololu.com/category/203/romi-chassis-kits, has a
// wheel placement diameter (149 mm) - width of the wheel (8 mm) = 141 mm
// or 5.551 inches. We then take into consideration the width of the tires.
static auto inchPerDegree = (5.551_in * wpi::math::pi) / 360_deg;
static auto inchPerDegree = (5.551_in * wpi::numbers::pi) / 360_deg;
// Compare distance traveled from start to distance based on degree turn.
return GetAverageTurningDistance() >= inchPerDegree * m_angle;

View File

@@ -4,7 +4,7 @@
#include "subsystems/Drivetrain.h"
#include <wpi/math>
#include <wpi/numbers>
#include "Constants.h"
@@ -16,9 +16,9 @@ using namespace DriveConstants;
// to use DIO pins 4/5 and 6/7 for the left and right
Drivetrain::Drivetrain() {
m_leftEncoder.SetDistancePerPulse(
wpi::math::pi * kWheelDiameter.to<double>() / kCountsPerRevolution);
wpi::numbers::pi * kWheelDiameter.to<double>() / kCountsPerRevolution);
m_rightEncoder.SetDistancePerPulse(
wpi::math::pi * kWheelDiameter.to<double>() / kCountsPerRevolution);
wpi::numbers::pi * kWheelDiameter.to<double>() / kCountsPerRevolution);
ResetEncoders();
}