mirror of
https://github.com/PhotonVision/photonvision
synced 2026-06-27 02:01:40 +00:00
Merge remote-tracking branch 'origin/master'
This commit is contained in:
11
backend/app/classes/ChameleonCamera.py
Normal file
11
backend/app/classes/ChameleonCamera.py
Normal file
@@ -0,0 +1,11 @@
|
||||
from ChameleonPipeLine import ChameleonPipeline
|
||||
|
||||
|
||||
class ChameleonCamera:
|
||||
|
||||
def __init__(self, dic):
|
||||
self.pipelines = []
|
||||
|
||||
for pipeline in dic["pipelines"]:
|
||||
self.pipelines.append(ChameleonPipeline(pipeline))
|
||||
|
||||
8
backend/app/classes/ChameleonPipeLine.py
Normal file
8
backend/app/classes/ChameleonPipeLine.py
Normal file
@@ -0,0 +1,8 @@
|
||||
|
||||
|
||||
class ChameleonPipeline:
|
||||
|
||||
def __init__(self, dic):
|
||||
self.id = dic["id"]
|
||||
self.exposure = dic["exposure"]
|
||||
self.brightness = dic["brightness"]
|
||||
0
backend/app/classes/__init__.py
Normal file
0
backend/app/classes/__init__.py
Normal file
@@ -1,5 +1,6 @@
|
||||
import tornado.websocket
|
||||
import json
|
||||
from classes.ChameleonCamera import ChameleonCamera
|
||||
|
||||
|
||||
class ChameleonWebSocket(tornado.websocket.WebSocketHandler):
|
||||
@@ -10,17 +11,40 @@ class ChameleonWebSocket(tornado.websocket.WebSocketHandler):
|
||||
def open(self):
|
||||
self.write_message(json.dumps(
|
||||
{
|
||||
'cam1':{
|
||||
'pipeline': 1,
|
||||
'exposure': 12
|
||||
'cam1': {
|
||||
'pipelines': [
|
||||
{"id": 1, "Exposure": 45}
|
||||
]
|
||||
}
|
||||
}
|
||||
))
|
||||
print("WebSocket opened")
|
||||
|
||||
def on_message(self, message):
|
||||
print(json.loads(message))
|
||||
# print(message)
|
||||
# print(json.loads(message))
|
||||
|
||||
cams = []
|
||||
|
||||
dic = {
|
||||
'cam1': {
|
||||
'pipelines': [
|
||||
{"id": 1, "exposure": 45, "brightness": 123123},
|
||||
{"id": 2, "exposure": 12, "brightness": 123},
|
||||
{"id": 3, "exposure": 23, "brightness": 12}
|
||||
]
|
||||
},
|
||||
'cam2': {
|
||||
'pipelines': [
|
||||
{"id": 1, "exposure": 15, "brightness": 1233},
|
||||
{"id": 2, "exposure": 68, "brightness": 453}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
for cam in dic:
|
||||
cams.append(ChameleonCamera(dic[cam]))
|
||||
|
||||
print(message)
|
||||
self.write_message(message)
|
||||
|
||||
def on_close(self):
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
|
||||
<template>
|
||||
<div id="InputTab">
|
||||
<chslider class="spacing" title="exposure" v-model="expval" v-on:input="onChange(expval)"></chslider>
|
||||
<chslider class="spacing" title="Brightness"></chslider>
|
||||
<chselect class="spacing" title="Orientation" :list="['Normal','Inverted']" v-model="OrientationVal" v-on:input="onChange(OrientationVal)" ></chselect>
|
||||
<chselect class="spacing" title="Resolution" :list="['idk']"></chselect>
|
||||
<chslider class="spacing" title="exposure" :parentData="values.exposure" @input="values.exposure = $event"></chslider>
|
||||
<chslider class="spacing" title="Brightness" :parentData="values.brightness" @input="values.brightness = $event"></chslider>
|
||||
<chselect class="spacing" title="Orientation" :list="['Normal','Inverted']" :parentData="values.orientation" @input="values.orientation = $event" ></chselect>
|
||||
<chselect class="spacing" title="Resolution" :list="['idk']" :parentData="values.resolution" @input="values.resolution = $event" ></chselect>
|
||||
</div>
|
||||
|
||||
</template>
|
||||
@@ -16,8 +16,12 @@ import chselect from './ch-select.vue'
|
||||
name: 'InputTab',
|
||||
data () {
|
||||
return{
|
||||
expval,
|
||||
OrientationVal
|
||||
values:{
|
||||
exposure:0,
|
||||
brightness:0,
|
||||
orientation:0,
|
||||
resolution:0
|
||||
}
|
||||
}
|
||||
},
|
||||
components: {
|
||||
@@ -26,9 +30,7 @@ import chselect from './ch-select.vue'
|
||||
},
|
||||
methods: {
|
||||
onChange(i) {
|
||||
// console.log(i);
|
||||
this.$socket.send(JSON.stringify(i));
|
||||
|
||||
console.log(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,7 +33,6 @@
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
|
||||
}
|
||||
},
|
||||
methods: {}
|
||||
|
||||
@@ -16,7 +16,8 @@
|
||||
name: 'ch-select',
|
||||
props:[
|
||||
'title',
|
||||
'list'
|
||||
'list',
|
||||
'parentData'
|
||||
],
|
||||
data() {
|
||||
return {
|
||||
@@ -25,8 +26,12 @@
|
||||
},
|
||||
methods: {
|
||||
handleInput() {
|
||||
this.$emit('input',{[this.title]:this.value});
|
||||
this.$emit('input',this.value);
|
||||
this.$socket.sendObj({[this.title]:this.value});
|
||||
}
|
||||
},
|
||||
beforeMount () {
|
||||
this.value = this.parentData
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -16,16 +16,20 @@
|
||||
<script>
|
||||
export default {
|
||||
name: 'ch-slider',
|
||||
props:['title','value'],
|
||||
props:['title','parentData'],
|
||||
data() {
|
||||
return {
|
||||
content:this.value
|
||||
value:0,
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
handleInput() {
|
||||
this.$emit('input',{[this.title]:this.value});
|
||||
this.$emit('input',this.value);
|
||||
this.$socket.sendObj({[this.title]:this.value});
|
||||
}
|
||||
},
|
||||
beforeMount () {
|
||||
this.value = this.parentData
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -9,7 +9,7 @@ import locale from 'iview/dist/locale/en-US';
|
||||
|
||||
Vue.use(VueRouter);
|
||||
Vue.use(iView , { locale });
|
||||
Vue.use(VueNativeSock,'ws://' + location.hostname + ':8888/websocket');
|
||||
Vue.use(VueNativeSock,'ws://'+location.hostname+':8888/websocket',{format:'JSON'});
|
||||
Vue.config.productionTip = false
|
||||
|
||||
new Vue({
|
||||
|
||||
Reference in New Issue
Block a user