3d, camera calibration, backend settings hookup (#80)

* Implement new UI backend stuff

* Kinda partially add resolution accuracy list

* camera calibration go brrrrrrrr

* ayyyy calibration works

* Maybe fix grouping

* Reorganize camera view

* Fix settings not getting sent

* Make pretty (#4)

* Reorganize camera view

* Apply some cosmetic layout changes to the cameras page

* Fix pipeline rollback bug when starting on non-dashboard pages

Co-authored-by: Matt <matthew.morley.ca@gmail.com>

* Fix naming mismatch

* Mostly make stuff work

* rename robot-relative pose to camera-relative pose

* SolvePNP memes, fix isFovConfigurable

* Change config path to photonvision_config

* netmask go poof, fix zip download?

* Update index.js

* Fix multi cam stuff?

* Use LinearFilter instead

* Fix multicam

* aaa

* start adding restart device and restart program, fix square size bug

* Add some debug stuff

* oop

* Start fixing tests

* Fix tests

* Make target box proportinal

* run spotless

* Make crosshair h o t p i n k

* Address review comments

* Address review 2 electric booaloo

* Possibly implement vendor FOV?

* Make centroid crosshair gren

* actually use FOV

* Fix tests

* actually fix tests

Co-authored-by: Declan Freeman-Gleason <declanfreemangleason@gmail.com>
This commit is contained in:
Matt
2020-08-14 12:39:21 -07:00
committed by GitHub
parent 86ea661ed9
commit b3436765e1
86 changed files with 2106 additions and 1173 deletions

View File

@@ -1,7 +1,6 @@
import Vue from 'vue'
import Vuex from 'vuex'
import networkSettings from "./modules/networkSettings"
import undoRedo from "./modules/undoRedo";
Vue.use(Vuex);
@@ -17,7 +16,6 @@ export default new Vuex.Store({
currentResolutionIndex: 0,
},
},
networkSettings: networkSettings,
undoRedo: undoRedo
},
state: {
@@ -43,6 +41,7 @@ export default new Vuex.Store({
"pixelFormat": "BGR"
}
],
calibrations: [ ],
fov: 70.0,
isFovConfigurable: true,
calibrated: false,
@@ -76,14 +75,14 @@ export default new Vuex.Store({
solvePNPEnabled: false,
targetRegion: 0,
contourTargetOrientation: 1,
is3D: false,
cornerDetectionAccuracyPercentage: 10,
// Settings that apply to shape
}
}
],
pipelineResults: [
{
pipelineResults: {
fps: 0,
latency: 0,
targets: [{
@@ -95,8 +94,7 @@ export default new Vuex.Store({
// 3D only
pose: {x: 0, y: 0, rotation: 0},
}]
}
],
},
settings: {
general: {
version: "Unknown",
@@ -106,7 +104,7 @@ export default new Vuex.Store({
hardwareModel: "Unknown",
hardwarePlatform: "Unknown",
},
networking: {
networkSettings: {
teamNumber: 0,
supported: true,
@@ -120,19 +118,29 @@ export default new Vuex.Store({
supported: true,
brightness: 0.0,
},
}
},
calibrationData: {
count: 0,
videoModeIndex: 0,
minCount: 25,
hasEnough: false,
squareSizeIn: 1.0,
patternWidth: 7,
patternHeight: 7,
boardType: 0, // Chessboard, dotboard
},
},
mutations: {
saveBar: set('saveBar'),
compactMode: set('compactMode'),
cameraSettings: set('cameraSettings'),
currentCameraIndex: set('currentCameraIndex'),
pipelineResults: set('pipelineResults'),
networkSettings: set('networkSettings'),
selectedOutputs: set('selectedOutputs'),
settings: set('settings'),
calibrationData: set('calibrationData'),
is3D: (state, val) => {
state.cameraSettings[state.currentCameraIndex].currentPipelineSettings.is3D = val;
solvePNPEnabled: (state, val) => {
state.cameraSettings[state.currentCameraIndex].currentPipelineSettings.solvePNPEnabled = val;
},
currentPipelineIndex: (state, val) => {
@@ -152,27 +160,50 @@ export default new Vuex.Store({
}
},
mutateSettings: (state, payload) => {
for (let key in payload) {
if (!payload.hasOwnProperty(key)) continue;
const value = payload[key];
const settings = state.settings;
if (settings.hasOwnProperty(key)) {
Vue.set(settings, key, value);
}
}
},
mutatePipelineResults(state, payload) {
// Key: index, value: result
let newResultArray = [];
for (let key in payload) {
if (!payload.hasOwnProperty(key)) continue;
const index = parseInt(key);
newResultArray[index] = payload[key];
if(index === state.currentCameraIndex) {
Vue.set(state, 'pipelineResults', payload[key])
}
}
Vue.set(state, 'pipelineResults', newResultArray)
}
},
mutateCalibrationState: (state, payload) => {
for (let key in payload) {
if (!payload.hasOwnProperty(key)) continue;
const value = payload[key];
const calibration = state.calibrationData;
if (calibration.hasOwnProperty(key)) {
calibration[key] = value
}
Vue.set(state, 'calibrationData', calibration)
}
},
},
getters: {
isDriverMode: state => state.cameraSettings[state.currentCameraIndex].currentPipelineIndex === -1,
pipelineSettings: state => state.pipelineSettings,
streamAddress: state =>
["http://" + location.hostname + ":" + state.cameraSettings[state.currentCameraIndex].inputStreamPort + "/stream.mjpg",
"http://" + location.hostname + ":" + state.cameraSettings[state.currentCameraIndex].outputStreamPort + "/stream.mjpg"],
targets: state => state.pipelineResults.length,
currentPipelineResults: state =>
state.pipelineResults[state.cameraSettings[state.currentCameraIndex].currentPipelineIndex],
currentPipelineResults: state => {
return state.pipelineResults;
},
cameraList: state => state.cameraSettings.map(it => it.nickname),
currentCameraSettings: state => state.cameraSettings[state.currentCameraIndex],
currentCameraIndex: state => state.currentCameraIndex,
@@ -182,6 +213,6 @@ export default new Vuex.Store({
return Object.values(state.cameraSettings[state.currentCameraIndex].videoFormatList); // convert to a list
},
pipelineList: state => state.cameraSettings[state.currentCameraIndex].pipelineNicknames,
currentCameraFPS: state => state.pipelineResults[state.currentCameraIndex].fps
calibrationList: state => state.cameraSettings[state.currentCameraIndex].calibrations,
}
})

View File

@@ -1,17 +0,0 @@
export default {
state: {
netmask: "",
ip: "",
teamNumber: "",
connectionType: "",
gateway: ""
},
mutations: {
},
actions: {},
getters: {
pipeline: state => {
return state
}
}
};

View File

@@ -1,45 +0,0 @@
import Vue from 'vue'
export default {
state: {
exposure: 0,
brightness: 0,
gain: 0,
rotationMode: 0,
hue: [0, 15],
saturation: [0, 15],
value: [0, 25],
erode: false,
dilate: false,
area: [0, 12],
ratio: [0, 12],
fullness: [0, 12],
speckle: 5,
targetGrouping: 0,
targetIntersection: 0,
sortMode: 0,
multiple: false,
isBinary: 0,
calibrationMode: 0,
videoModeIndex: 0,
streamDivisor: 0,
is3D: false,
targetRegion: 0,
targetOrientation: 1
},
mutations: {
isBinary: (state, value) => {
state.isBinary = value
},
mutatePipeline: (state, {key, value}) => {
Vue.set(state, key, value)
}
},
actions: {},
getters: {
pipeline: state => {
return state
}
}
};