-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbvps_main.py
More file actions
44 lines (41 loc) · 1.48 KB
/
bvps_main.py
File metadata and controls
44 lines (41 loc) · 1.48 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# -*- coding: utf-8 -*-
import sys
import os
import logging as log
from bvps.system.actor_system import actor_system as asys
from bvps.system.sysActor import SystemActor
from bvps.system.position_actor import PositionActor
from bvps.system.torch_actor import TorchActor
from bvps.camera.camera import Camera
from rpsc.start import server_start
from bvps.common import CameraCmdType, CameraCmd
import time
try:
server_start(asys)
sa = asys.createActor(SystemActor, globalName="SystemActor")
position = asys.createActor(
PositionActor, globalName="CameraPositionActor")
#ta = asys.createActor(TorchActor, globalName="TorchActor")
# 未来会从数据库或者配置文件中读取
# 定位摄像头 type == 1
# 采集摄像头 type == 2
from bvps.config import cameras
# 启动采集摄像头
# todo:消息反馈处理和异常处理
for camId, params in cameras.items():
cama = asys.createActor(Camera, globalName=camId)
cameras[camId]["address"] = cama
print("启动摄像头{},命令CameraCmdType.START_CAPTURE,address:{}".format(
camId, cama))
msg = asys.ask(cama,
CameraCmd(CameraCmdType.START_CAPTURE, camId, params),
600)
print("camera:{} result:{}".format(camId, msg))
#asys.tell(ta, "TorchActor"*100)
except KeyboardInterrupt:
print('Interrupted')
try:
asys.shutdown()
sys.exit(0)
except SystemExit:
os._exit(0)