mirror of
https://github.com/PhotonVision/photonvision
synced 2026-06-20 00:51:41 +00:00
Add modal and animations while calibration is running (#157)
* Add modal for calibration * Run wpiformat
This commit is contained in:
@@ -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) {
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user