diff --git a/test/java/src/junit/test/neuronrobotics/utilities/RotationNRTest.java b/test/java/src/junit/test/neuronrobotics/utilities/RotationNRTest.java index 25c91ca4..b33d41f9 100644 --- a/test/java/src/junit/test/neuronrobotics/utilities/RotationNRTest.java +++ b/test/java/src/junit/test/neuronrobotics/utilities/RotationNRTest.java @@ -5,6 +5,7 @@ import org.junit.Test; import com.neuronrobotics.sdk.addons.kinematics.math.RotationNR; +import com.neuronrobotics.sdk.util.ThreadUtil; // TODO: Auto-generated Javadoc /** @@ -18,16 +19,17 @@ public class RotationNRTest { @Test public void test() { int failCount = 0; - for (int i = 0; i < 100; i++) { - double tilt = Math.toRadians(Math.random() * 360.0 - 180); - double elevation = Math.toRadians(Math.random() * 360.0 - 180); - double azumus = Math.toRadians(Math.random() * 360.0 - 180); + int iterations = 100; + for (int i = 0; i < iterations; i++) { + double tilt = Math.toRadians((Math.random() *360.0) - 180); + double elevation = Math.toRadians((Math.random() * 360.0) - 180); + double azumus = Math.toRadians((Math.random() * 360.0) - 180); RotationNR rotTest = new RotationNR(Math.toDegrees(tilt), Math.toDegrees(azumus), Math.toDegrees(elevation)); System.out.println("\n\nTest #" + i); System.out.println("Testing Az=" + Math.toDegrees(azumus) + " El=" + Math.toDegrees(elevation) + " Tl=" + Math.toDegrees(tilt)); - System.out.println("Got Az=" + Math.toDegrees(rotTest.getRotationAzimuth()) + " El=" + System.out.println("Got Az=" + Math.toDegrees(rotTest.getRotationAzimuth()) + " El=" + Math.toDegrees(rotTest.getRotationElevation()) + " Tl=" + Math.toDegrees(rotTest.getRotationTilt())); if (!RotationNR.bound(tilt - .001, tilt + .001, rotTest.getRotationTilt())) { @@ -45,10 +47,14 @@ public void test() { System.err.println("Rotation Tilt is not consistant. expected " + Math.toDegrees(azumus) + " got " + Math.toDegrees(rotTest.getRotationAzimuth())); } + ThreadUtil.wait(20); + + + } if (failCount > 1) { - fail("Rotation failed " + failCount + " times"); + fail("Rotation failed " + failCount + " times of "+iterations*3); }