mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-07-06 03:31:43 +00:00
Merge "More updates to the Gyro test fixing potential null pointer exception"
This commit is contained in:
@@ -100,7 +100,7 @@ public class GyroTest extends AbstractComsSetup {
|
|||||||
assertEquals(errorMessage(angle, 0), 0, angle, .5);
|
assertEquals(errorMessage(angle, 0), 0, angle, .5);
|
||||||
Timer.delay(5);
|
Timer.delay(5);
|
||||||
angle = gyro.getAngle();
|
angle = gyro.getAngle();
|
||||||
assertEquals("After 5 seconds " + errorMessage(angle, 0), 0, angle, 1);
|
assertEquals("After 5 seconds " + errorMessage(angle, 0), 0, angle, 2.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -65,6 +65,7 @@ public abstract class TiltPanCameraFixture implements ITestFixture {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean reset() {
|
public boolean reset() {
|
||||||
|
if(gyro != null)
|
||||||
gyro.reset();
|
gyro.reset();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -101,8 +102,14 @@ public abstract class TiltPanCameraFixture implements ITestFixture {
|
|||||||
tilt = null;
|
tilt = null;
|
||||||
pan.free();
|
pan.free();
|
||||||
pan = null;
|
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.free();
|
||||||
gyroParam = null;
|
gyroParam = null;
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user