Use chessboard squares (vs interior corners); fix resolution selector bug (#139)

* Change chessboard size to be squares not interior corners

This reduces ambiguity

* Force users to select resolution

This forces the correct video mode index to be selected. Otherwise the 0th camera videomode index will be used, as it's zero-inited. This is undesirable.

* Make target model an enum

This will allow the UI to remember the currently selected target.
This commit is contained in:
Matt
2020-10-13 06:58:50 -07:00
committed by GitHub
parent 6e0a6b804e
commit 23f3c0e6e1
13 changed files with 146 additions and 194 deletions

View File

@@ -1,52 +0,0 @@
{
"2020 Hex Goal": {
"realWorldCoordinatesArray": [
{
"x": -0.49847498536109924,
"y": 0.0,
"z": 0.0
},
{
"x": -0.24942462146282196,
"y": -0.4318000078201294,
"z": 0.0
},
{
"x": 0.24942462146282196,
"y": -0.4318000078201294,
"z": 0.0
},
{
"x": 0.49847498536109924,
"y": 0.0,
"z": 0.0
}
],
"boxHeight": 0.30479999999999996
},
"2019 Dual Target": {
"realWorldCoordinatesArray": [
{
"x": -0.15077440440654755,
"y": 0.06761480122804642,
"z": 0.0
},
{
"x": -0.18575020134449005,
"y": -0.06761480122804642,
"z": 0.0
},
{
"x": 0.18575020134449005,
"y": -0.06761480122804642,
"z": 0.0
},
{
"x": 0.15077440440654755,
"y": 0.06761480122804642,
"z": 0.0
}
],
"boxHeight": 0.1
}
}

View File

@@ -122,8 +122,8 @@ export default new Vuex.Store({
minCount: 25,
hasEnough: false,
squareSizeIn: 1.0,
patternWidth: 7,
patternHeight: 7,
patternWidth: 8,
patternHeight: 8,
boardType: 0, // Chessboard, dotboard
},
metrics: {

View File

@@ -93,14 +93,14 @@
v-model="boardWidth"
name="Board width"
label-cols="5"
tooltip="Width of the board in dots or corners; with the standard chessboard, this is usually 7"
tooltip="Width of the board in dots or chessboard squares; with the standard chessboard, this is usually 8"
:disabled="isCalibrating"
/>
<CVnumberinput
v-model="boardHeight"
name="Board height"
label-cols="5"
tooltip="Height of the board in dots or corners; with the standard chessboard, this is usually 7"
tooltip="Height of the board in dots or chessboard squares; with the standard chessboard, this is usually 8"
:disabled="isCalibrating"
/>
</v-col>
@@ -291,7 +291,7 @@ export default {
text: ""
},
snack: false,
filteredVideomodeIndex: 0
filteredVideomodeIndex: undefined,
}
},
computed: {
@@ -409,7 +409,6 @@ export default {
return this.$store.getters.currentPipelineIndex === -2;
}
},
selectedFilteredResIndex: {
get() {
return this.filteredVideomodeIndex

View File

@@ -16,10 +16,10 @@
color="accent"
item-color="secondary"
label="Select a target model"
:items="FRCtargets"
:items="targetList"
item-text="name"
item-value="data"
@change="onModelSelect"
@input="handlePipelineUpdate('targetModel', targetList.indexOf(selectedModel))"
/>
<CVslider
v-model="cornerDetectionAccuracyPercentage"
@@ -51,7 +51,6 @@
import Papa from 'papaparse';
import miniMap from '../../components/pipeline/3D/MiniMap';
import CVslider from '../../components/common/cv-slider'
import FRCtargetsConfig from '../../assets/FRCtargets'
export default {
name: "SolvePNP",
@@ -61,18 +60,25 @@
},
data() {
return {
FRCtargets: null,
targetList: ['2020 High Goal Outer', '2020 High Goal Inner', '2019 Dual Target', 'Power Cell (7in)'],
snackbar: {
color: "Success",
text: ""
},
snack: false,
selectedModel: {
isCustom: false
}
}
},
computed: {
selectedModel: {
get() {
let ret = this.$store.getters.currentPipelineSettings.targetModel
console.log(ret)
return this.targetList[ret];
},
set(val) {
this.$store.commit("mutatePipeline", {"targetModel": this.targetList.indexOf(val)})
}
},
cornerDetectionAccuracyPercentage: {
get() {
return this.$store.getters.currentPipelineSettings.cornerDetectionAccuracyPercentage
@@ -97,20 +103,6 @@
}
},
},
mounted() {
let tmp = [];
for (let t in FRCtargetsConfig) {
if (FRCtargetsConfig.hasOwnProperty(t)) {
tmp.push({name: t, data: FRCtargetsConfig[t]});
}
}
// Special dropdown item for uploading your own model
// data is what gets put in selectedMode, so we add a special field
tmp.push({name: "Custom model", data: {isCustom: true}});
this.FRCtargets = tmp;
},
methods: {
readFile(event) {
let file = event.target.files[0];
@@ -119,13 +111,6 @@
skipEmptyLines: true
});
},
onModelSelect() {
if (this.selectedModel.isCustom) {
this.$refs.file.click();
} else {
this.uploadPremade();
}
},
onParse(result) {
if (result.data.length > 0) {
let data = [];
@@ -158,29 +143,6 @@
this.selectedModel = null;
}
},
uploadPremade() {
this.uploadModel(this.selectedModel, true);
},
uploadModel(model, premade = false) {
this.axios.post("http://" + this.$address + "/api/vision/pnpModel", {
['targetModel']: model,
['index']: this.$store.getters.currentCameraIndex
}).then(() => {
this.snackbar = {
color: "success",
text: premade ? "Target model changed successfully" : "Custom target model uploaded and selected successfully"
};
this.snack = true;
}).catch(() => {
this.snackbar = {
color: "error",
text: "An error occurred selecting a target model"
};
this.snack = true;
this.selectedModel = null;
});
}
}
}
</script>