mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-20 00:51:42 +00:00
[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:
@@ -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;
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user