## features
-- added pi cam support (from wpilib v2020.2.2)
-- added gain slider for ps3 eye
-- added custom pnp model upload
-- network tables will try to reconnect if no connection
-- re did network tables key and added new values 


## bug fixes
-- fixed solve pnp not detection
-- lowered minimum fps for some camera
-- fixed vision hang bug
This commit is contained in:
Banks T
2020-01-22 14:53:11 -05:00
committed by oriagranat9
parent 0e2e950d18
commit a0b89168b4
30 changed files with 719 additions and 198 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

@@ -2,9 +2,12 @@
<div>
<CVslider name="Exposure" v-model="value.exposure" :min="0" :max="100" @input="handleData('exposure')"/>
<CVslider name="Brightness" v-model="value.brightness" :min="0" :max="100" @input="handleData('brightness')"/>
<CVslider name="Gain" v-if="value.gain !== -1" v-model="value.gain" :min="0" :max="100"
@input="handleData('gain')"/>
<CVselect name="Orientation" v-model="value.rotationMode" :list="['Normal','90° CW','180°','90° CCW']"
@input="handleData('rotationMode')"/>
<CVselect name="Resolution" v-model="value.videoModeIndex" :list="resolutionList" @input="handleData('videoModeIndex')"/>
<CVselect name="Resolution" v-model="value.videoModeIndex" :list="resolutionList"
@input="handleData('videoModeIndex')"/>
<CVselect name="Stream Resolution" v-model="value.streamDivisor"
:list="streamResolutionList" @input="handleData('streamDivisor')"/>
</div>
@@ -46,9 +49,9 @@
streamResolutionList: {
get() {
let cam_res = this.$store.state.resolutionList[this.value.videoModeIndex];
let tmp_list = [];
let tmp_list = [];
tmp_list.push(`${Math.floor(cam_res['width'])} X ${Math.floor(cam_res['height'])}`);
for (let x = 2; x <= 6; x+=2) {
for (let x = 2; x <= 6; x += 2) {
tmp_list.push(`${Math.floor(cam_res['width'] / x)} X ${Math.floor(cam_res['height'] / x)}`);
}
return tmp_list;