From f436b33d79d04406700c8246f8354d4fc4681f28 Mon Sep 17 00:00:00 2001 From: Patrick Date: Mon, 8 Feb 2016 15:03:51 -0500 Subject: [PATCH] More updates to the Gyro test fixing potential null pointer exception also retuned the deviation over time test to make it pass more reliably. Ran sucessfully 40/40 times run including several run with the entire wpilibj Change-Id: I2e42c368fdb81f9206e15ce39878ea105da1e405 --- .../src/main/java/edu/wpi/first/wpilibj/GyroTest.java | 2 +- .../wpi/first/wpilibj/fixtures/TiltPanCameraFixture.java | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/wpilibjIntegrationTests/src/main/java/edu/wpi/first/wpilibj/GyroTest.java b/wpilibjIntegrationTests/src/main/java/edu/wpi/first/wpilibj/GyroTest.java index f878f1f49a..c878a64d31 100644 --- a/wpilibjIntegrationTests/src/main/java/edu/wpi/first/wpilibj/GyroTest.java +++ b/wpilibjIntegrationTests/src/main/java/edu/wpi/first/wpilibj/GyroTest.java @@ -100,7 +100,7 @@ public class GyroTest extends AbstractComsSetup { assertEquals(errorMessage(angle, 0), 0, angle, .5); Timer.delay(5); angle = gyro.getAngle(); - assertEquals("After 5 seconds " + errorMessage(angle, 0), 0, angle, 1); + assertEquals("After 5 seconds " + errorMessage(angle, 0), 0, angle, 2.0); } /** diff --git a/wpilibjIntegrationTests/src/main/java/edu/wpi/first/wpilibj/fixtures/TiltPanCameraFixture.java b/wpilibjIntegrationTests/src/main/java/edu/wpi/first/wpilibj/fixtures/TiltPanCameraFixture.java index 29e06833c2..002443ad17 100644 --- a/wpilibjIntegrationTests/src/main/java/edu/wpi/first/wpilibj/fixtures/TiltPanCameraFixture.java +++ b/wpilibjIntegrationTests/src/main/java/edu/wpi/first/wpilibj/fixtures/TiltPanCameraFixture.java @@ -65,6 +65,7 @@ public abstract class TiltPanCameraFixture implements ITestFixture { @Override public boolean reset() { + if(gyro != null) gyro.reset(); return true; } @@ -101,8 +102,14 @@ public abstract class TiltPanCameraFixture implements ITestFixture { tilt = null; pan.free(); pan = null; + if(gyro !=null){//in case not freed during gyro tests + gyro.free(); + gyro = null; + } + if(gyroParam != null){//in case gyro tests failed before getting to this point gyroParam.free(); gyroParam = null; + } return true; }