[wpimath] Revert Rotation2D change that limits angles (#4781)

Reverts "[wpimath] Constrain Rotation2d range to -pi to pi (#4611)"
This reverts commit d1d458db2b.

This broke multiple teams code in beta. It is also easier to limit the angle externally, then reconstruct a larger angle that got limited. This additionally adds comments to clarify the behavior and retains tests that were added in the reverted commit, and fixes a javadoc comment angle reference.
This commit is contained in:
sciencewhiz
2022-12-08 18:10:44 -08:00
committed by GitHub
parent 0f5b08ec69
commit 989c9fb29a
7 changed files with 54 additions and 56 deletions

View File

@@ -13,15 +13,6 @@ import org.junit.jupiter.api.Test;
class Rotation2dTest {
private static final double kEpsilon = 1E-9;
@Test
void testInScope() {
var rot1 = Rotation2d.fromRadians(Math.PI * 5 / 2);
var rot2 = Rotation2d.fromRadians(Math.PI * 7 / 2);
assertEquals(Math.PI / 2, rot1.getRadians(), kEpsilon);
assertEquals(-Math.PI / 2, rot2.getRadians(), kEpsilon);
}
@Test
void testRadiansToDegrees() {
var rot1 = Rotation2d.fromRadians(Math.PI / 3);
@@ -80,7 +71,7 @@ class Rotation2dTest {
var rot = Rotation2d.fromDegrees(10.0);
assertEquals(30.0, rot.times(3.0).getDegrees(), kEpsilon);
assertEquals(50.0, rot.times(41.0).getDegrees(), kEpsilon);
assertEquals(410.0, rot.times(41.0).getDegrees(), kEpsilon);
}
@Test