Add modal and animations while calibration is running (#157)

* Add modal for calibration

* Run wpiformat
This commit is contained in:
Matt
2020-11-21 18:14:27 -08:00
committed by GitHub
parent da2aaba033
commit 2ae750f00f
3 changed files with 111 additions and 59 deletions

View File

@@ -162,6 +162,7 @@ public class RequestHandler {
}
public static void onCalibrationEnd(Context ctx) {
logger.info("Calibrating camera! This will take a long time...");
var index = Integer.parseInt(ctx.body());
var calData = VisionModuleManager.getInstance().getModule(index).endCalibration();
if (calData == null) {
@@ -171,6 +172,7 @@ public class RequestHandler {
ctx.result(String.valueOf(calData.standardDeviation));
ctx.status(200);
logger.info("Camera calibrated!");
}
public static void restartDevice(Context ctx) {

View File

@@ -60,6 +60,8 @@ public class Calibrate3dPipeline
private int minSnapshots;
private boolean calibrating = false;
public Calibrate3dPipeline() {
this(25);
}
@@ -89,6 +91,11 @@ public class Calibrate3dPipeline
// Set the pipe parameters
setPipeParams(frame.frameStaticProperties, settings);
if (this.calibrating) {
return new CVPipelineResult(
0, null, new Frame(new CVMat(frame.image.getMat()), frame.frameStaticProperties));
}
long sumPipeNanosElapsed = 0L;
// Check if the frame has chessboard corners
@@ -131,10 +138,14 @@ public class Calibrate3dPipeline
return null;
}
this.calibrating = true;
/*Pass the board corners to the pipe, which will check again to see if all boards are valid
and returns the corresponding image and object points*/
calibrationOutput = calibrate3dPipe.run(foundCornersList);
this.calibrating = false;
return calibrationOutput.output;
}