mirror of
https://github.com/PhotonVision/photonvision
synced 2026-06-21 01:01:41 +00:00
moved res and divisor into pipeline in ui
-- added handling of divisor and res in socket handler -- moved pipeline to be index -1 in ui -- removed driver mode object
This commit is contained in:
@@ -2,6 +2,7 @@ package com.chameleonvision.vision.pipeline;
|
||||
|
||||
import com.chameleonvision.vision.enums.ImageFlipMode;
|
||||
import com.chameleonvision.vision.enums.ImageRotationMode;
|
||||
import com.chameleonvision.vision.enums.StreamDivisor;
|
||||
|
||||
@SuppressWarnings("ALL")
|
||||
public class CVPipelineSettings {
|
||||
@@ -12,4 +13,6 @@ public class CVPipelineSettings {
|
||||
public double exposure = 50.0;
|
||||
public double brightness = 50.0;
|
||||
public double gain = 0;
|
||||
public int VideoModeIndex = 0;
|
||||
public StreamDivisor streamDivisor = StreamDivisor.NONE;
|
||||
}
|
||||
|
||||
@@ -49,13 +49,7 @@ public class RequestHandler {
|
||||
} catch (Exception ignored) {
|
||||
newFOV = (Integer) camSettings.get("fov");
|
||||
}
|
||||
Integer newStreamDivisor = (Integer) camSettings.get("streamDivisor");
|
||||
Integer newResolution = (Integer) camSettings.get("resolution");
|
||||
|
||||
currentCamera.getProperties().setFOV(newFOV);
|
||||
currentVisionProcess.cameraStreamer.setDivisor(StreamDivisor.values()[newStreamDivisor], true);
|
||||
currentCamera.setVideoMode(newResolution);
|
||||
|
||||
VisionManager.saveCurrentCameraSettings();
|
||||
SocketHandler.sendFullSettings();
|
||||
ctx.status(200);
|
||||
|
||||
@@ -4,6 +4,7 @@ import com.chameleonvision.config.ConfigManager;
|
||||
import com.chameleonvision.vision.VisionManager;
|
||||
import com.chameleonvision.vision.VisionProcess;
|
||||
import com.chameleonvision.vision.camera.CameraCapture;
|
||||
import com.chameleonvision.vision.enums.StreamDivisor;
|
||||
import com.chameleonvision.vision.pipeline.CVPipeline;
|
||||
import com.chameleonvision.vision.pipeline.CVPipelineSettings;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
@@ -148,6 +149,13 @@ public class SocketHandler {
|
||||
case "brightness": {
|
||||
currentCamera.setBrightness((Integer) entry.getValue());
|
||||
}
|
||||
case "videoMode":{
|
||||
currentCamera.setVideoMode((Integer) entry.getValue());
|
||||
}
|
||||
case "streamDivisor":{
|
||||
VisionProcess currentVisionProcess = VisionManager.getCurrentUIVisionProcess();
|
||||
currentVisionProcess.cameraStreamer.setDivisor(StreamDivisor.values()[(Integer) entry.getValue()], true);
|
||||
}
|
||||
}
|
||||
|
||||
VisionManager.saveCurrentCameraPipelines();
|
||||
@@ -230,16 +238,6 @@ public class SocketHandler {
|
||||
return tmp;
|
||||
}
|
||||
|
||||
private static HashMap<String, Object> getOrdinalDriver() {
|
||||
HashMap<String, Object> tmp = new HashMap<>();
|
||||
VisionProcess currentProcess = VisionManager.getCurrentUIVisionProcess();
|
||||
CVPipelineSettings driverModeSettings = currentProcess.pipelineManager.driverModePipeline.settings;
|
||||
tmp.put("isDriver", currentProcess.pipelineManager.getDriverMode());
|
||||
tmp.put("driverBrightness", driverModeSettings.brightness);
|
||||
tmp.put("driverExposure", driverModeSettings.exposure);
|
||||
return tmp;
|
||||
}
|
||||
|
||||
public static void sendFullSettings() {
|
||||
//General settings
|
||||
Map<String, Object> fullSettings = new HashMap<>();
|
||||
@@ -252,7 +250,6 @@ public class SocketHandler {
|
||||
fullSettings.put("cameraSettings", getOrdinalCameraSettings());
|
||||
fullSettings.put("cameraList", VisionManager.getAllCameraNicknames());
|
||||
fullSettings.put("pipeline", getOrdinalPipeline(currentPipeline.settings.getClass()));
|
||||
fullSettings.put("driverMode", getOrdinalDriver());
|
||||
fullSettings.put("pipelineList", VisionManager.getCurrentCameraPipelineNicknames());
|
||||
fullSettings.put("resolutionList", VisionManager.getCurrentCameraResolutionList());
|
||||
fullSettings.put("port", currentProcess.cameraStreamer.getStreamPort());
|
||||
|
||||
@@ -35,12 +35,9 @@ export default new Vuex.Store({
|
||||
sortMode: 0,
|
||||
multiple:false,
|
||||
isBinary: 0,
|
||||
calibrationMode: 0
|
||||
},
|
||||
driverMode: {
|
||||
isDriver: false,
|
||||
driverExposure: 0,
|
||||
driverBrightness: 0
|
||||
calibrationMode: 0,
|
||||
VideoModeIndex:0,
|
||||
streamDivisor:0
|
||||
},
|
||||
cameraSettings: {},
|
||||
resolutionList: [],
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
<v-col :cols="3" class="colsClass">
|
||||
<CVselect v-if="isPipelineEdit === false" name="Pipeline" :list="pipelineList"
|
||||
v-model="currentPipelineIndex"
|
||||
@input="handleInput('currentPipeline',currentPipelineIndex)"/>
|
||||
@input="handleInput('currentPipeline',currentPipelineIndex - 1)"/>
|
||||
<CVinput v-else name="Pipeline" v-model="newPipelineName" @Enter="savePipelineNameChange"/>
|
||||
</v-col>
|
||||
<v-col :cols="1" class="colsClass" md="3">
|
||||
@@ -76,12 +76,13 @@
|
||||
<!-- vision tabs -->
|
||||
<v-col cols="6" class="colsClass">
|
||||
<v-tabs fixed-tabs background-color="#212121" dark height="48" slider-color="#4baf62"
|
||||
v-model="selectedTab">
|
||||
v-model="selectedTab" v-if="currentPipelineIndex !== 0">
|
||||
<v-tab>Input</v-tab>
|
||||
<v-tab>Threshold</v-tab>
|
||||
<v-tab>Contours</v-tab>
|
||||
<v-tab>Output</v-tab>
|
||||
</v-tabs>
|
||||
<div v-else style="height: 48px"></div>
|
||||
<div style="padding-left:30px">
|
||||
<keep-alive>
|
||||
<!-- vision component -->
|
||||
@@ -251,6 +252,9 @@
|
||||
},
|
||||
selectedComponent: {
|
||||
get() {
|
||||
if (this.currentPipelineIndex === 0){
|
||||
return "InputTab"
|
||||
}
|
||||
switch (this.selectedTab) {
|
||||
case 0:
|
||||
return "InputTab";
|
||||
@@ -272,7 +276,7 @@
|
||||
try {
|
||||
return `Pitch: ${parseFloat(p['pitch']).toFixed(2)}, Yaw: ${parseFloat(p['yaw']).toFixed(2)}, Area: ${p['area'].toFixed(2)}, FPS: ${fps.toFixed(2)}`
|
||||
} catch (e) {
|
||||
return ""
|
||||
return ""
|
||||
}
|
||||
} else {
|
||||
return undefined;
|
||||
@@ -289,10 +293,10 @@
|
||||
},
|
||||
currentPipelineIndex: {
|
||||
get() {
|
||||
return this.$store.state.currentPipelineIndex;
|
||||
return this.$store.state.currentPipelineIndex + 1;
|
||||
},
|
||||
set(value) {
|
||||
this.$store.commit('currentPipelineIndex', value);
|
||||
this.$store.commit('currentPipelineIndex', value - 1);
|
||||
}
|
||||
},
|
||||
cameraList: {
|
||||
@@ -302,7 +306,10 @@
|
||||
},
|
||||
pipelineList: {
|
||||
get() {
|
||||
return this.$store.state.pipelineList;
|
||||
let tmp = ["Driver Mode"];
|
||||
let pipelineList = this.$store.state.pipelineList;
|
||||
tmp = tmp.concat(pipelineList);
|
||||
return tmp;
|
||||
}
|
||||
},
|
||||
pipeline: {
|
||||
|
||||
@@ -4,6 +4,9 @@
|
||||
<CVslider name="Brightness" v-model="value.brightness" :min="0" :max="100" @input="handleData('brightness')"/>
|
||||
<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="Stream Resolution" v-model="value.streamDivisor"
|
||||
:list="streamResolutionList" @input="handleData('streamDivisor')"/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -30,7 +33,29 @@
|
||||
a: 1
|
||||
}
|
||||
},
|
||||
computed: {}
|
||||
computed: {
|
||||
resolutionList: {
|
||||
get() {
|
||||
let tmp_list = [];
|
||||
for (let i of this.$store.state.resolutionList) {
|
||||
tmp_list.push(`${i['width']} X ${i['height']} at ${i['fps']} FPS, ${i['pixelFormat']}`)
|
||||
}
|
||||
return tmp_list;
|
||||
}
|
||||
},
|
||||
streamResolutionList: {
|
||||
get() {
|
||||
let cam_res = this.$store.state.resolutionList[this.value.VideoModeIndex];
|
||||
let tmp_list = [];
|
||||
let x = 1;
|
||||
for (let i = 0; i < 4; i++) {
|
||||
tmp_list.push(`${cam_res['width'] / x} X ${cam_res['height'] / x}`);
|
||||
x *= 2;
|
||||
}
|
||||
return tmp_list;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
v-model="selectedTab">
|
||||
<v-tab to="">General</v-tab>
|
||||
<v-tab to="">Cameras</v-tab>
|
||||
<v-tab to="">Driver Mode</v-tab>
|
||||
</v-tabs>
|
||||
<div style="padding-left:30px">
|
||||
<component :is="selectedComponent" @update="$emit('save')"/>
|
||||
@@ -24,14 +23,13 @@
|
||||
<script>
|
||||
import General from './SettingsViewes/General'
|
||||
import Cameras from './SettingsViewes/Cameras'
|
||||
import DriverMode from './SettingsViewes/DriverMode'
|
||||
|
||||
|
||||
export default {
|
||||
name: 'SettingsTab',
|
||||
components: {
|
||||
General,
|
||||
Cameras,
|
||||
DriverMode
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
@@ -46,8 +44,6 @@
|
||||
return "General";
|
||||
case 1:
|
||||
return "Cameras";
|
||||
case 2:
|
||||
return "DriverMode";
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
@@ -1,9 +1,6 @@
|
||||
<template>
|
||||
<div>
|
||||
<CVselect name="Camera" :list="cameraList" v-model="currentCameraIndex"/>
|
||||
<CVselect name="Resolution" v-model="cameraSettings.resolution" :list="resolutionList"/>
|
||||
<CVselect name="Stream Resolution" v-model="cameraSettings.streamDivisor"
|
||||
:list="streamResolutionList"/>
|
||||
<CVnumberinput name="Diagonal FOV" v-model="cameraSettings.fov"/>
|
||||
<v-btn style="margin-top:10px" small color="#4baf62" @click="sendCameraSettings">Save Camera Settings</v-btn>
|
||||
</div>
|
||||
@@ -27,7 +24,7 @@
|
||||
const self = this;
|
||||
this.axios.post("http://" + this.$address + "/api/settings/camera", this.cameraSettings).then(
|
||||
function (response) {
|
||||
if (response.status === 200){
|
||||
if (response.status === 200) {
|
||||
self.$store.state.saveBar = true;
|
||||
}
|
||||
}
|
||||
@@ -52,27 +49,6 @@
|
||||
this.$store.commit('cameraList', value);
|
||||
}
|
||||
},
|
||||
resolutionList: {
|
||||
get() {
|
||||
let tmp_list = [];
|
||||
for (let i of this.$store.state.resolutionList){
|
||||
tmp_list.push(`${i['width']} X ${i['height']} at ${i['fps']} FPS, ${i['pixelFormat']}`)
|
||||
}
|
||||
return tmp_list;
|
||||
}
|
||||
},
|
||||
streamResolutionList:{
|
||||
get(){
|
||||
let cam_res = this.$store.state.resolutionList[this.cameraSettings.resolution];
|
||||
let tmp_list = [];
|
||||
let x = 1;
|
||||
for (let i = 0; i < 4; i++){
|
||||
tmp_list.push(`${cam_res['width']/x} X ${cam_res['height']/x}`);
|
||||
x *= 2;
|
||||
}
|
||||
return tmp_list;
|
||||
}
|
||||
},
|
||||
cameraSettings: {
|
||||
get() {
|
||||
return this.$store.state.cameraSettings;
|
||||
|
||||
@@ -1,62 +0,0 @@
|
||||
<template>
|
||||
<div>
|
||||
<CVselect name="Camera" :list="cameraList" v-model="currentCameraIndex"/>
|
||||
<CVswitch v-model="driverState.isDriver" name="Driver Mode" @input="sendDriverMode"/>
|
||||
<CVslider name="Exposure" v-model="driverState.driverExposure" :min="0" :max="100" @input="sendDriverMode"/>
|
||||
<CVslider name="Brightness" v-model="driverState.driverBrightness" :min="0" :max="100"
|
||||
@input="sendDriverMode"/>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import CVselect from '../../components/cv-select'
|
||||
import CVswitch from '../../components/cv-switch'
|
||||
import CVslider from '../../components/cv-slider'
|
||||
|
||||
export default {
|
||||
name: "DriverMode",
|
||||
components: {
|
||||
CVselect,
|
||||
CVswitch,
|
||||
CVslider
|
||||
},
|
||||
methods: {
|
||||
sendDriverMode() {
|
||||
this.handleInput('driverMode', this.driverState);
|
||||
this.$emit("update");
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
currentCameraIndex: {
|
||||
get() {
|
||||
return this.$store.state.currentCameraIndex;
|
||||
},
|
||||
set(value) {
|
||||
this.$store.commit('currentCameraIndex', value);
|
||||
}
|
||||
},
|
||||
cameraList: {
|
||||
get() {
|
||||
return this.$store.state.cameraList;
|
||||
},
|
||||
set(value) {
|
||||
this.$store.commit('cameraList', value);
|
||||
}
|
||||
|
||||
},
|
||||
driverState: {
|
||||
get() {
|
||||
return this.$store.state.driverMode;
|
||||
},
|
||||
set(value) {
|
||||
this.$store.commit("driverMode", value);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
||||
Reference in New Issue
Block a user