mirror of
https://github.com/PhotonVision/photonvision
synced 2026-06-28 02:11:40 +00:00
updates from session
This commit is contained in:
@@ -4,8 +4,10 @@ from .ChameleonPipeLine import ChameleonPipeline
|
||||
class ChameleonCamera:
|
||||
|
||||
def __init__(self, dic):
|
||||
self.pipelines = []
|
||||
self.pipelines = {}
|
||||
|
||||
for pipeline in dic["pipelines"]:
|
||||
self.pipelines.append(ChameleonPipeline(pipeline))
|
||||
for pipeline_id in dic["pipelines"]:
|
||||
self.pipelines[pipeline_id] = ChameleonPipeline(dic[pipeline_id])
|
||||
|
||||
def change_value(self, pipline_id, key, value):
|
||||
self.pipelines[pipline_id][key] = value
|
||||
@@ -5,4 +5,4 @@ class ChameleonPipeline:
|
||||
def __init__(self, dic):
|
||||
self.id = dic["id"]
|
||||
self.exposure = dic["exposure"]
|
||||
self.brightness = dic["brightness"]
|
||||
self.brightness = dic["brightness"]
|
||||
|
||||
@@ -9,35 +9,36 @@ class ChameleonWebSocket(tornado.websocket.WebSocketHandler):
|
||||
return True
|
||||
|
||||
def open(self):
|
||||
self.write_message(json.dumps(
|
||||
{
|
||||
'cam1': {
|
||||
'pipelines': [
|
||||
{"id": 1, "Exposure": 45}
|
||||
]
|
||||
}
|
||||
}
|
||||
))
|
||||
|
||||
# TODO: read setting from default file store them
|
||||
setting = json.load("file.json")
|
||||
self.cam_name = setting["curr_cam"]
|
||||
self.pipe_line = setting["curr_pipeline"]
|
||||
|
||||
# TODO: get current camera pipeline file
|
||||
curr_setting = json.load(self.cam_name + "/" + self.pipe_line)
|
||||
|
||||
# TODO: wrtie current pipeline setting to client
|
||||
self.write_message(curr_setting)
|
||||
|
||||
print("WebSocket opened")
|
||||
|
||||
def on_message(self, 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}
|
||||
]
|
||||
'pipelines': {
|
||||
"1": {"exposure": 45, "brightness": 123123},
|
||||
"2": {"exposure": 12, "brightness": 123},
|
||||
"3": {"exposure": 23, "brightness": 12}
|
||||
}
|
||||
},
|
||||
'cam2': {
|
||||
'pipelines': [
|
||||
{"id": 1, "exposure": 15, "brightness": 1233},
|
||||
{"id": 2, "exposure": 68, "brightness": 453}
|
||||
]
|
||||
'pipelines': {
|
||||
"1": {"exposure": 15, "brightness": 1233},
|
||||
"2": {"exposure": 68, "brightness": 453}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user