added custom cvs upload and premade targets

This commit is contained in:
ori agranat
2020-01-13 21:48:24 +02:00
parent 709752249d
commit c46d4e04b0
3 changed files with 51 additions and 17 deletions

View File

@@ -0,0 +1,14 @@
{
"2020 Hex Goal": [
[-19.625, 0],
[-9.819867, -17],
[9.819867, -17],
[19.625,0]
],
"2019 Dual Target": [
[-7.75, 3],
[-7.75, -3],
[7.75, -3],
[7.75, 3]
]
}

View File

@@ -4,35 +4,44 @@
<v-col :cols="6">
<CVswitch :disabled="allow3D" v-model="value.is3D" name="Enable 3D" @input="handleData('is3D')"/>
</v-col>
<!-- <v-col>-->
<!-- <input type="file" ref="file" style="display: none" accept=".csv" @change="readFile">-->
<!-- <v-btn @click="$refs.file.click()" small>-->
<!-- upload model-->
<!-- </v-btn>-->
<!-- </v-col>-->
<v-col>
<input type="file" ref="file" style="display: none" accept=".csv" @change="readFile">
<v-btn @click="$refs.file.click()" small>
<v-icon>mdi-upload</v-icon>
upload model
</v-btn>
</v-col>
</v-row>
<v-row>
<v-col>
<mini-map class="miniMapClass" :targets="targets" :horizontal-f-o-v="horizontalFOV"/>
</v-col>
<v-col>
<v-select v-model="selectedModel" :items="FRCtargets" item-text="name" item-value="data" dark color="#4baf62" item-color="green"/>
<v-btn small v-if="selectedModel !== null" @click="uploadPremade">Upload Premade</v-btn>
</v-col>
</v-row>
<mini-map class="miniMapClass" :targets="targets" :horizontal-f-o-v="horizontalFOV"/>
</div>
</template>
<script>
import miniMap from '../../components/3D/MiniMap';
import CVswitch from '../../components/cv-switch';
import CVnumberInput from '../../components/cv-number-input';
import Papa from 'papaparse';
import FRCtargetsConfig from '../../assets/FRCtargets'
export default {
name: "solvePNP",
props: ['value'],
components: {
CVswitch,
CVnumberInput,
miniMap
},
data() {
return {
is3D: false,
isPNPCalibration: false,
selectedModel: null,
FRCtargets: null
}
},
methods: {
@@ -48,9 +57,14 @@
});
},
onParse(result) {
// console.log(result.data);
this.axios.post("http://" + this.$address + "/api/vision/pnpModel", result.data);
this.uploadModel(result.data);
},
uploadPremade() {
this.uploadModel(this.selectedModel);
},
uploadModel(model) {
this.axios.post("http://" + this.$address + "/api/vision/pnpModel", model);
}
},
computed: {
targets: {
@@ -68,17 +82,24 @@
return Math.atan(Math.tan(diagonalView / 2) * (resolution.width / diagonalAspect)) * 2 * (180 / Math.PI)
}
},
allow3D:{
get(){
allow3D: {
get() {
let currentRes = this.$store.state.resolutionList[this.$store.state.pipeline.videoModeIndex];
for (let res of this.$store.state.cameraSettings.calibration){
if (currentRes.width === res.width && currentRes.height === res.height){
for (let res of this.$store.state.cameraSettings.calibration) {
if (currentRes.width === res.width && currentRes.height === res.height) {
return false;
}
}
return true;
}
}
},
mounted() {
let tmp = [];
for (let t in FRCtargetsConfig) {
tmp.push({name: t, data: FRCtargetsConfig[t]})
}
this.FRCtargets = tmp;
}
}
</script>

View File

@@ -176,7 +176,6 @@ public class RequestHandler {
}
public static void onPnpModel(Context ctx) throws JsonProcessingException {
System.out.println(ctx.body());
ObjectMapper objectMapper = kObjectMapper;
List points = objectMapper.readValue(ctx.body(), List.class);
System.out.println(points);