Bootup sprint (#18)

* Did some stuff

* Fix gradle, start implementing mjpeg frame consumer

* Did some stuff

* bade changes

* rename camera config to USBCameraConfiguration, add name

* unrename cameraconfiguration

* Add pub/sub framework

* Add setResolution to mjpeg frame consumer

* add NTDataConsumer

* Add some totally broken hsv hacks

* Start refactoring UI data

* Update index.js

* Commit and push, he says

* Fix up some errors

* Fix input tab

* Fix fps

* Update index.js

* Add pipeline field setting, update PipelineManager, fix nullpointers and USBCameraSettables

* Change v-model to point to data()

* update hsv to use mutations

* Work on saving, fix hsv

* Rename shouldErode/shouldDilate to erode and dilate

* Hook all the tabs up to the Store

* Change handleData to handlePipelineData

* camera quirk redo, add ICCSub to SocketHandler

* Fix some property names

* Fixed tons of naming in UI, fix backend for multi-val PSCs, fix PSC enums

* change pipeline type to an int in store

* Fix mutation naming

* Attempt threshold fix

* Update SocketHandler.java

* Add truthy data sending

* Start adding logging support

* [UI] Add delay to slider input boxes (#1)

* [UI] [Backend] potentially fix camera settings, various logging tweaks

* Don't release raw input mat

* add setVideoModeIndex to vision settables

* Implement pipeline index in socket handler, add framework for renaming/changing pipes

* (ish) get pipeline change working

* Create index.html

* Cleanups, fix pipeline index bug, fix stream res for MJPG, add dashboard stream (unused)

* Refactor UI to use mutatePipeline, send pipeline results

* Update NetworkConfig.java

* Change double to number

* Run spotless

* Fix reversal of large/small comparators

* Fix left/right

* Fix pitch/yaw calculation bug, fix area bug

* Use Vue.set instead of assignment

This fixes {{ }}

* Update App.vue

* run spotless

* Actually add pipelines and reassign indecies

* Delete old pipeline configs

Fixes duplication on renaming pipeline

* Start working on deleting pipes

* Fix camera nickname change

* run spotless

* Fix some test stuff

* Update VisionModuleManagerTest.java

* vision source manager test is still broken

* Fix VisionSourceManager test

* Apply spotless 2 electric boogaloo

Co-authored-by: Banks Troutman <btrout.dhrs@gmail.com>
Co-authored-by: Declan Freeman-Gleason <declanfreemangleason@gmail.com>
Co-authored-by: Aaryan Agrawal <54345060+13Ducks@users.noreply.github.com>
This commit is contained in:
Matt
2020-07-07 01:01:58 -07:00
committed by GitHub
parent 01712a7396
commit 4cd2262acc
106 changed files with 3666 additions and 623 deletions

View File

@@ -1,9 +1,7 @@
import Vue from 'vue'
import Vuex from 'vuex'
import pipeline from "./modules/pipeline";
import generalSettings from "./modules/generalSettings";
import cameraSettings from "./modules/cameraSettings";
import networkSettings from "./modules/networkSettings"
import undoRedo from "./modules/undoRedo";
Vue.use(Vuex);
@@ -14,53 +12,137 @@ const set = key => (state, val) => {
export default new Vuex.Store({
modules: {
pipeline: pipeline,
settings: generalSettings,
cameraSettings: cameraSettings,
reflectivePipelineSettings: {
state: {
currentResolutionIndex: 0,
},
},
networkSettings: networkSettings,
undoRedo: undoRedo
},
state: {
resolutionList: [],
port: 1181,
currentCameraIndex: 0,
currentPipelineIndex: 0,
cameraList: [],
pipelineList: [],
point: {},
saveBar: false
saveBar: false,
cameraSettings: [ // This is a list of objects representing the settings of all cameras
{
tiltDegrees: 0.0,
currentPipelineIndex: 0,
pipelineNicknames: ["Unknown"],
streamPort: 1181,
nickname: "Unknown",
videoFormatList: [
{
"width": 1920,
"height": 1080,
"fps": 30,
"pixelFormat": "BGR"
}
],
fov: 70.0,
calibrated: false,
currentPipelineSettings: {
pipelineType: 2, // One of "driver", "reflective", "shape"
// 2 is reflective
// Settings that apply to all pipeline types
cameraExposure: 1,
cameraBrightness: 2,
cameraGain: 3,
inputImageRotationMode: 0,
cameraVideoModeIndex: 0,
outputFrameDivisor: 0,
// Settings that apply to reflective
hsvHue: [0, 15],
hsvSaturation: [0, 15],
hsvValue: [0, 25],
erode: false,
dilate: false,
contourArea: [0, 12],
contourRatio: [0, 12],
contourExtent: [0, 12],
contourSpecklePercentage: 5,
contourGroupingMode: 0,
contourIntersection: 0,
contourSortMode: 0,
outputShowMultipleTargets: false,
outputShowThresholded: 0,
offsetRobotOffsetMode: 0,
solvePNPEnabled: false,
targetRegion: 0,
contourTargetOrientation: 1
// Settings that apply to shape
}
}
],
pipelineResults: [
{
fps: 0,
targets: [{
// Available in both 2D and 3D
pitch: 0,
yaw: 0,
skew: 0,
area: 0,
// 3D only
pose: {x: 0, y: 0, rot: 0},
}]
}
]
},
mutations: {
settings: set('settings'),
pipeline: set('pipeline'),
cameraSettings: set('cameraSettings'),
resolutionList: set('resolutionList'),
port: set('port'),
saveBar: set('saveBar'),
currentCameraIndex: set('currentCameraIndex'),
currentPipelineIndex: set('currentPipelineIndex'),
cameraList: set('cameraList'),
pipelineList: set('pipelineList'),
point: set('point'),
driverMode: set('driverMode'),
saveBar: set("saveBar")
pipelineResults: set('pipelineResults'),
networkSettings: set('networkSettings'),
currentPipelineIndex: (state, val) => {
const settings = state.cameraSettings[state.currentCameraIndex];
Vue.set(settings, 'currentPipelineIndex', val);
},
// TODO change everything to use this
mutatePipeline: (state, payload) => {
for (let key in payload) {
if (!payload.hasOwnProperty(key)) continue;
const value = payload[key];
const settings = state.cameraSettings[state.currentCameraIndex].currentPipelineSettings;
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];
}
Vue.set(state, 'pipelineResults', newResultArray)
}
},
getters: {
streamAddress: state => {
return "http://" + location.hostname + ":" + state.port + "/stream.mjpg";
pipelineSettings: state => state.pipelineSettings,
streamAddress: state =>
"http://" + location.hostname + ":" + state.cameraSettings[state.currentCameraIndex].streamPort + "/stream.mjpg",
targets: state => state.pipelineResults.length,
currentPipelineResults: state =>
state.pipelineResults[state.cameraSettings[state.currentCameraIndex].currentPipelineIndex],
cameraList: state => state.cameraSettings.map(it => it.nickname),
currentCameraSettings: state => state.cameraSettings[state.currentCameraIndex],
currentCameraIndex: state => state.currentCameraIndex,
currentPipelineIndex: state => state.cameraSettings[state.currentCameraIndex].currentPipelineIndex,
currentPipelineSettings: state => state.cameraSettings[state.currentCameraIndex].currentPipelineSettings,
videoFormatList: state => {
return Object.values(state.cameraSettings[state.currentCameraIndex].videoFormatList); // convert to a list
},
targets: state => {
return state.point['targets']
},
cameraList: state => {
return state.cameraList
},
pipelineList: state => {
return state.pipelineList
},
currentCameraIndex: state => {
return state.currentCameraIndex
},
currentPipelineIndex: state => {
return state.currentPipelineIndex
}
pipelineList: state => state.cameraSettings[state.currentCameraIndex].pipelineNicknames,
currentCameraFPS: state => state.pipelineResults[state.currentCameraIndex].fps
}
})
})

View File

@@ -1,14 +0,0 @@
export default {
state: {
calibration: [],
fov: 0,
resolution: 0,
streamDivisor: 0,
tilt: 0
},
getters: {
cameraSettings: state => {
return state
}
}
}

View File

@@ -1,10 +0,0 @@
export default {
state:{
teamNumber: 0,
connectionType: 0,
ip: "",
gateway: "",
netmask: "",
hostname: "photon-vision"
}
}

View File

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