From 61ccea38f42940f588628e726931dd86572c7e5d Mon Sep 17 00:00:00 2001 From: thenetworkgrinch Date: Fri, 20 Dec 2024 12:27:38 -0600 Subject: [PATCH] Avoid rotation2d is 0 warning. Signed-off-by: thenetworkgrinch --- src/main/java/swervelib/math/SwerveMath.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main/java/swervelib/math/SwerveMath.java b/src/main/java/swervelib/math/SwerveMath.java index eea10e40..7fa8f718 100644 --- a/src/main/java/swervelib/math/SwerveMath.java +++ b/src/main/java/swervelib/math/SwerveMath.java @@ -399,6 +399,10 @@ public static void antiJitter(SwerveModuleState moduleState, SwerveModuleState l */ public static Translation2d cubeTranslation(Translation2d translation) { + if (Math.hypot(translation.getX(), translation.getY()) <= 1.0E-6) + { + return translation; + } return new Translation2d(Math.pow(translation.getNorm(), 3), translation.getAngle()); }