mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-23 01:21: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:
@@ -4,7 +4,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <wpi/math>
|
||||
#include <wpi/numbers>
|
||||
|
||||
#include "units/angle.h"
|
||||
|
||||
@@ -38,8 +38,9 @@ constexpr T InputModulus(T input, T minimumInput, T maximumInput) {
|
||||
* @param angle Angle to wrap.
|
||||
*/
|
||||
constexpr units::radian_t AngleModulus(units::radian_t angle) {
|
||||
return InputModulus<units::radian_t>(angle, units::radian_t{-wpi::math::pi},
|
||||
units::radian_t{wpi::math::pi});
|
||||
return InputModulus<units::radian_t>(angle,
|
||||
units::radian_t{-wpi::numbers::pi},
|
||||
units::radian_t{wpi::numbers::pi});
|
||||
}
|
||||
|
||||
} // namespace frc
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <wpi/math>
|
||||
#include <wpi/numbers>
|
||||
|
||||
#include "Eigen/Core"
|
||||
#include "frc/MathUtil.h"
|
||||
@@ -59,7 +59,7 @@ Eigen::Matrix<double, States, 1> AngleAdd(
|
||||
const Eigen::Matrix<double, States, 1>& b, int angleStateIdx) {
|
||||
Eigen::Matrix<double, States, 1> ret = a + b;
|
||||
ret[angleStateIdx] =
|
||||
InputModulus(ret[angleStateIdx], -wpi::math::pi, wpi::math::pi);
|
||||
InputModulus(ret[angleStateIdx], -wpi::numbers::pi, wpi::numbers::pi);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
@@ -28,8 +28,6 @@
|
||||
|
||||
#include <cmath>
|
||||
|
||||
#include <wpi/math>
|
||||
|
||||
#include "units/angle.h"
|
||||
#include "units/base.h"
|
||||
#include "units/dimensionless.h"
|
||||
|
||||
Reference in New Issue
Block a user