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