mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-21 01:01:43 +00:00
[wpimath] Deduplicate angle modulus functions (#2998)
frc::NormalizeAngle(), units::math::NormalizeAngle(), and frc::GetModulusError() were replaced with frc::InputModulus() and frc::AngleModulus(). They were placed in wpimath/src/main/native/include/frc/MathUtil.h for C++ and wpimath/src/main/java/edu/wpi/first/wpiutil/math/MathUtil.java for Java.
This commit is contained in:
@@ -4,6 +4,8 @@
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include <wpi/math>
|
||||
|
||||
#include "Eigen/Core"
|
||||
#include "frc/estimator/AngleStatistics.h"
|
||||
|
||||
@@ -33,11 +35,3 @@ TEST(AngleStatisticsTest, TestAdd) {
|
||||
|
||||
EXPECT_TRUE(frc::AngleAdd<3>(a, b, 1).isApprox(Eigen::Vector3d(2, 0, 3)));
|
||||
}
|
||||
|
||||
TEST(AngleStatisticsTest, TestNormalize) {
|
||||
EXPECT_NEAR(frc::NormalizeAngle(-2000 * wpi::math::pi / 180),
|
||||
160 * wpi::math::pi / 180, 1e-6);
|
||||
EXPECT_NEAR(frc::NormalizeAngle(358 * wpi::math::pi / 180),
|
||||
-2 * wpi::math::pi / 180, 1e-6);
|
||||
EXPECT_NEAR(frc::NormalizeAngle(360 * wpi::math::pi / 180), 0, 1e-6);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user