Merge "More updates to the Gyro test fixing potential null pointer exception"

This commit is contained in:
Brad Miller (WPI)
2016-02-11 11:17:06 -08:00
committed by Gerrit Code Review
2 changed files with 8 additions and 1 deletions

View File

@@ -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);
}
/**

View File

@@ -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;
}