Skip to content

Commit

Permalink
Merge branch 'master' into misc-fix
Browse files Browse the repository at this point in the history
  • Loading branch information
srimanachanta committed Jun 26, 2023
2 parents 911bac8 + 715ef62 commit 2c0f139
Show file tree
Hide file tree
Showing 91 changed files with 4,068 additions and 1,381 deletions.
37 changes: 37 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Set default behavior to automatically normalize line endings (LF on check-in).
* text=auto

# Force batch scripts to always use CRLF line endings so that if a repo is accessed
# in Windows via a file share from Linux, the scripts will work.
*.{cmd,[cC][mM][dD]} text eol=crlf
*.{bat,[bB][aA][tT]} text eol=crlf
*.{ics,[iI][cC][sS]} text eol=crlf

# Force bash scripts to always use LF line endings so that if a repo is accessed
# in Unix via a file share from Windows, the scripts will work.
*.sh text eol=lf

# Ensure Spotless does not try to use CRLF line endings on Windows in the local repo.
*.gradle text eol=lf
*.java text eol=lf
*.json text eol=lf
*.md text eol=lf
*.xml text eol=lf
*.h text eol=lf
*.hpp text eol=lf
*.inc text eol=lf
*.inl text eol=lf
*.cpp text eol=lf

# Frontend Files
*.js text eol=lf
*.vue text eol=lf

# Denote all files that are truly binary and should not be modified.
*.png binary
*.jpg binary
*.jpeg binary
*.gif binary
*.so binary
*.dll binary
*.webp binary
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ build/spotlessJava
build/*
build
photon-lib/src/main/java/org/photonvision/PhotonVersion.java
photon-lib/bin/main/images/*
/photonlib-java-examples/bin/
photon-lib/src/generate/native/include/PhotonVersion.h
.gitattributes
Expand Down
1 change: 1 addition & 0 deletions .styleguide
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ modifiableFileExclude {
\.so$
\.dll$
\.webp$
gradlew
}

includeProject {
Expand Down
2 changes: 1 addition & 1 deletion photon-client/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@ export default {
this.previouslySelectedIndices = null;
},
switchToSettingsTab() {
this.axios.post('http://' + this.$address + '/api/sendMetrics', {})
this.axios.post('http://' + this.$address + '/api/utils/publishMetrics')
}
}
};
Expand Down
64 changes: 59 additions & 5 deletions photon-client/src/components/pipeline/CameraAndPipelineSelect.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
<template>
<div>
<v-snackbar
v-model="snack"
top
:color="snackbar.color"
:timeout="2000"
>
<span>{{ snackbar.text }}</span>
</v-snackbar>
<v-row
align="center"
style="padding: 12px 12px 12px 24px"
Expand Down Expand Up @@ -223,7 +231,12 @@ export default {
duplicateDialog: false,
showPipeTypeDialog: false,
proposedPipelineType : 0,
pipeIndexToDuplicate: undefined
pipeIndexToDuplicate: undefined,
snack: false,
snackbar: {
color: "success",
text: "",
}
}
},
computed: {
Expand Down Expand Up @@ -280,6 +293,51 @@ export default {
this.handleInputWithIndex('pipelineType', newIdx);
this.showPipeTypeDialog = false;
},
changeCameraName() {
this.newCameraName = this.$store.getters.cameraList[this.currentCameraIndex];
this.isCameraNameEdit = true;
},
saveCameraNameChange() {
if (this.checkCameraName === "") {
this.axios.post('http://' + this.$address + '/api/settings/camera/setNickname',
{name: this.newCameraName, cameraIndex: this.$store.getters.currentCameraIndex})
.then(response => {
this.$emit('camera-name-changed')
this.snackbar = {
color: "success",
text: response.data.text || response.data
}
this.snack = true;
})
.catch(error => {
this.$emit('camera-name-changed')
if(error.response) {
this.snackbar = {
color: "error",
text: error.response.data.text || error.response.data
}
} else if(error.request) {
this.snackbar = {
color: "error",
text: "Error while trying to process the request! The backend didn't respond.",
};
} else {
this.snackbar = {
color: "error",
text: "An error occurred while trying to process the request.",
};
}
this.snack = true;
})
this.discardCameraNameChange();
}
},
discardCameraNameChange() {
this.isCameraNameEdit = false;
this.newCameraName = "";
},
toPipelineNameChange() {
this.newPipelineName = this.$store.getters.pipelineList[this.currentPipelineIndex - 1];
this.isPipelineNameEdit = true;
Expand Down Expand Up @@ -319,7 +377,3 @@ export default {
}
</script>

<style scoped>
</style>
97 changes: 52 additions & 45 deletions photon-client/src/views/CamerasView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,7 @@
<v-col>
<v-btn
color="secondary"
:disabled="isCalibrating"
small
style="width: 100%;"
@click="$refs.importCalibrationFromCalibdb.click()"
Expand Down Expand Up @@ -376,7 +377,7 @@
style="border-radius: 5px;"
/>
<v-dialog
v-model="snack"
v-model="calibrationDialog"
width="500px"
:persistent="true"
>
Expand Down Expand Up @@ -445,12 +446,12 @@
>

<v-snackbar
v-model="uploadSnack"
v-model="snack"
top
:color="uploadSnackData.color"
timeout="-1"
:color="snackbar.color"
timeout="2000"
>
<span>{{ uploadSnackData.text }}</span>
<span>{{ snackbar.text }}</span>
</v-snackbar>
</div>
</template>
Expand Down Expand Up @@ -489,11 +490,11 @@ export default {
filteredVideomodeIndex: 0,
settingsValid: true,
unfilteredStreamDivisors: [1, 2, 4],
uploadSnackData: {
snackbar: {
color: "success",
text: "",
},
uploadSnack: false,
snack: false,
}
},
computed: {
Expand Down Expand Up @@ -711,43 +712,34 @@ export default {
};
this.axios
.post("http://" + this.$address + "/api/calibration/import", data, {
.post("http://" + this.$address + "/api/calibration/importFromCalibDB", data, {
headers: { "Content-Type": "text/plain" },
})
.then(() => {
this.uploadSnackData = {
color: "success",
text:
"Calibration imported successfully!",
};
this.uploadSnack = true;
.then((response) => {
this.snackbar = {
color: response.status === 200 ? "success" : "error",
text: response.data.text || response.data
}
this.snack = true;
})
.catch((err) => {
if (err.response) {
this.uploadSnackData = {
color: "error",
text:
"Error while uploading calibration file! Could not process provided file.",
};
} else if (err.request) {
this.uploadSnackData = {
if (err.request) {
this.snackbar = {
color: "error",
text:
"Error while uploading calibration file! No respond to upload attempt.",
text: "Error while uploading calibration file! The backend didn't respond to the upload attempt.",
};
} else {
this.uploadSnackData = {
this.snackbar = {
color: "error",
text: "Error while uploading calibration file!",
};
}
this.uploadSnack = true;
this.snack = true;
});
})
},
closeDialog() {
this.snack = false;
this.calibrationDialog = false;
this.calibrationInProgress = false;
this.calibrationFailed = false;
},
Expand Down Expand Up @@ -841,15 +833,33 @@ export default {
doc.save(`calibrationTarget-${config.type}.pdf`)
},
sendCameraSettings() {
this.axios.post("http://" + this.$address + "/api/settings/camera", {
"settings": this.cameraSettings,
"index": this.$store.state.currentCameraIndex
}).then(response => {
if (response.status === 200) {
this.$store.state.saveBar = true;
this.axios.post("http://" + this.$address + "/api/settings/camera", {"settings": this.cameraSettings, "index": this.$store.state.currentCameraIndex})
.then(response => {
this.snackbar = {
color: "success",
text: response.data.text || response.data
}
this.snack = true;
})
.catch(error => {
if(error.response) {
this.snackbar = {
color: "error",
text: error.response.data.text || error.response.data
}
}
)
} else if(error.request) {
this.snackbar = {
color: "error",
text: "Error while trying to process the request! The backend didn't respond.",
};
} else {
this.snackbar = {
color: "error",
text: "An error occurred while trying to process the request.",
};
}
this.snack = true;
})
},
isCalibrated(resolution) {
return this.$store.getters.currentCameraSettings.calibrations
Expand All @@ -876,16 +886,13 @@ export default {
sendCalibrationFinish() {
console.log("finishing calibration for index " + this.$store.getters.currentCameraIndex);
this.snack = true;
this.calibrationDialog = true;
this.calibrationInProgress = true;
this.axios.post("http://" + this.$address + "/api/settings/endCalibration", {idx: this.$store.getters.currentCameraIndex})
.then((response) => {
if (response.status === 200) {
this.calibrationInProgress = false;
} else {
this.calibrationFailed = true;
}
this.axios.post("http://" + this.$address + "/api/calibration/end", {index: this.$store.getters.currentCameraIndex})
.then(() => {
// End calibration will always return a 200 code on success
this.calibrationInProgress = false;
}
).catch(() => {
this.calibrationFailed = true;
Expand Down
2 changes: 1 addition & 1 deletion photon-client/src/views/LogsView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<a
ref="exportLogFile"
style="color: black; text-decoration: none; display: none"
:href="'http://' + this.$address + '/api/settings/photonvision-journalctl.txt'"
:href="'http://' + this.$address + '/api/utils/logs/photonvision-journalctl.txt'"
download="photonvision-journalctl.txt"
/>
</v-btn>
Expand Down
2 changes: 1 addition & 1 deletion photon-client/src/views/PipelineViews/OutputTab.vue
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
/>
<v-snackbar
v-model="snackbar"
:timeout="3000"
:timeout="2000"
top
color="error"
>
Expand Down
Loading

0 comments on commit 2c0f139

Please sign in to comment.