Skip to content

Commit 22490b8

Browse files
authored
Add an error when the connection for the end calibration request fails (#1840)
1 parent 3ac509b commit 22490b8

File tree

3 files changed

+18
-2
lines changed

3 files changed

+18
-2
lines changed

photon-client/src/components/cameras/CameraCalibrationCard.vue

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,8 +182,10 @@ const startCalibration = () => {
182182
const showCalibEndDialog = ref(false);
183183
const calibCanceled = ref(false);
184184
const calibSuccess = ref<boolean | undefined>(undefined);
185+
const calibEndpointFail = ref(false);
185186
const endCalibration = () => {
186187
calibSuccess.value = undefined;
188+
calibEndpointFail.value = false;
187189
188190
if (!useStateStore().calibrationData.hasEnoughImages) {
189191
calibCanceled.value = true;
@@ -196,7 +198,13 @@ const endCalibration = () => {
196198
.then(() => {
197199
calibSuccess.value = true;
198200
})
199-
.catch(() => {
201+
.catch((e) => {
202+
if (e.response) {
203+
// Server returned a status code
204+
} else if (e.request) {
205+
// Something went wrong. Unsure if calibration actually worked
206+
calibEndpointFail.value = true;
207+
}
200208
calibSuccess.value = false;
201209
})
202210
.finally(() => {
@@ -525,6 +533,13 @@ const setSelectedVideoFormat = (format: VideoFormat) => {
525533
}}!
526534
</v-card-text>
527535
</template>
536+
<template v-else-if="calibEndpointFail">
537+
<v-icon color="gray" size="70"> mdi-help-circle-outline </v-icon>
538+
<v-card-text
539+
>Unable to determine if calibration was successful. Refresh this page and manually check if calibration
540+
was successful.</v-card-text
541+
>
542+
</template>
528543
<template v-else>
529544
<v-icon color="red" size="70"> mdi-close </v-icon>
530545
<v-card-text>

photon-core/src/main/java/org/photonvision/vision/pipeline/Calibrate3dPipeline.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ public void finishCalibration() {
210210
broadcastState();
211211
}
212212

213-
private void broadcastState() {
213+
public void broadcastState() {
214214
var state =
215215
SerializationUtils.objectToHashMap(
216216
new UICalibrationData(

photon-core/src/main/java/org/photonvision/vision/processes/VisionModule.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -395,6 +395,7 @@ public void startCalibration(UICalibrationData data) {
395395
settings.cameraAutoExposure = true;
396396

397397
setPipeline(PipelineManager.CAL_3D_INDEX);
398+
pipelineManager.calibration3dPipeline.broadcastState();
398399
}
399400

400401
public void saveInputSnapshot() {

0 commit comments

Comments
 (0)