-
Notifications
You must be signed in to change notification settings - Fork 2
/
kbo.py
66 lines (49 loc) · 2.01 KB
/
kbo.py
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
import threading
from settings import START_FRAME
from Video.video import play, play_bbox, play_API
from Video.tts import TTS
from Web.web import Web
from Vision.vision import Vision
from resource import Resource
class KBO():
def __init__(self, isSimulation=False, isAPI=False):
if isAPI:
print("====================As API====================")
from Api.api import API
self.resource = Resource()
self.web = Web(resource=self.resource)
self.vision = Vision(resource=self.resource)
#self.run_server(host="166.104.143.103", port=8080)
self.run_server()
elif isSimulation:
print("====================Simulation====================")
self.run_bbox()
else:
print("====================In Local====================")
self.resource = Resource()
self.web = Web(resource=self.resource)
self.vision = Vision(resource=self.resource)
self.tts = TTS(resource=self.resource)
self.run()
def run(self):
self.resource.set_frameno(START_FRAME + 1)
idx = self.web.parsing_before()
web_thread = threading.Thread(target=self.web.parsing_relaytext, args=(idx,))
web_thread.start()
vision_thread = threading.Thread(target=self.vision.play)
vision_thread.start()
tts = threading.Thread(target=self.tts.text_2_speech)
tts.start()
play(self.resource)
def run_bbox(self):
play_bbox(frameno=128400)
def run_server(self):
self.resource.set_frameno(START_FRAME + 1)
idx = self.web.parsing_before()
web_thread = threading.Thread(target=self.web.parsing_relaytext, args=(idx, True))
web_thread.start()
vision_thread = threading.Thread(target=self.vision.play)
vision_thread.start()
play_API(self.resource, host="169.254.17.149", port=8080)
if __name__ == '__main__':
app = KBO(isSimulation=False, isAPI=True)