Update TwoWheelPinpointIMULocalizer.java

This commit is contained in:
Havish Sripada
2024-12-19 12:48:00 -08:00
committed by GitHub
parent e4f0447312
commit 38856c90dc

View File

@ -103,6 +103,7 @@ public class TwoWheelPinpointIMULocalizer extends Localizer {
deltaTimeNano = 1; deltaTimeNano = 1;
displacementPose = new Pose(); displacementPose = new Pose();
currentVelocity = new Pose(); currentVelocity = new Pose();
previousHeading = startPose.getHeading();
deltaRadians = 0; deltaRadians = 0;
} }
@ -293,8 +294,28 @@ public class TwoWheelPinpointIMULocalizer extends Localizer {
* This resets the IMU. * This resets the IMU.
*/ */
public void resetIMU() { @Override
public void resetIMU() throws InterruptedException {
pinpoint.recalibrateIMU();
try {
Thread.sleep(300);
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
}
/**
* This resets the pinpoint.
*/
private void resetPinpoint() {
pinpoint.resetPosAndIMU(); pinpoint.resetPosAndIMU();
try {
Thread.sleep(300);
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
} }
} }