mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-21 01:01:43 +00:00
[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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user