protected void calculateIsLeftRightPath(double angle) { int discreteAngleRepresentation = AngleTools.findClosestNinetyDegreeYaw(angle); isRightwardPath = discreteAngleRepresentation == 1; isLeftRightPath = discreteAngleRepresentation % 2 == 1; }
protected void calculateIsLeftRightPath(double angle) { int discreteAngleRepresentation = AngleTools.findClosestNinetyDegreeYaw(angle); isRightwardPath = discreteAngleRepresentation == 1; isLeftRightPath = discreteAngleRepresentation % 2 == 1; }
@ContinuousIntegrationTest(estimatedDuration = 0.0) @Test(timeout = 30000) public void testFindClosestNinetyDegreeYaw() { double yawInRadians; int expectedReturn, actualReturn; yawInRadians = -0.4 * Math.PI; expectedReturn = 3; actualReturn = AngleTools.findClosestNinetyDegreeYaw(yawInRadians); assertEquals(expectedReturn, actualReturn); yawInRadians = 0.6 * Math.PI; expectedReturn = 1; actualReturn = AngleTools.findClosestNinetyDegreeYaw(yawInRadians); assertEquals(expectedReturn, actualReturn); yawInRadians = 0.9 * Math.PI; expectedReturn = 2; actualReturn = AngleTools.findClosestNinetyDegreeYaw(yawInRadians); assertEquals(expectedReturn, actualReturn); yawInRadians = 2.4 * Math.PI; expectedReturn = 1; actualReturn = AngleTools.findClosestNinetyDegreeYaw(yawInRadians); assertEquals(expectedReturn, actualReturn); yawInRadians = 4 * Math.PI; expectedReturn = 0; actualReturn = AngleTools.findClosestNinetyDegreeYaw(yawInRadians); assertEquals(expectedReturn, actualReturn); }