Skip to content

Commit

Permalink
Avoid rotation2d is 0 warning.
Browse files Browse the repository at this point in the history
Signed-off-by: thenetworkgrinch <thenetworkgrinch@users.noreply.github.com>
  • Loading branch information
thenetworkgrinch committed Dec 20, 2024
1 parent 89ce82d commit 61ccea3
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/main/java/swervelib/math/SwerveMath.java
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}

Expand Down

0 comments on commit 61ccea3

Please sign in to comment.