-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.py
78 lines (57 loc) · 1.95 KB
/
main.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
67
68
69
70
71
72
73
74
75
76
77
78
from PyQt5.QtWidgets import QApplication
from gui import MainWindow
from unify import Unify
import sys
import os
import queue
import logging
import yaml
from threading import Thread
from time import sleep
from controls import Controls
def unify_listener():
while True:
if guiQueue.qsize() != 0:
output = guiQueue.get()
window.update_thruster_values(output[0])
window.update_axis_values(output[1])
sleep(0.01)
if __name__ == '__main__':
# controls = None
controls = Controls(offshoreEnabled=False)
# controls.comms.startThread()
with open('settings.yml', 'r') as f:
settings = yaml.safe_load(f)
app = QApplication([])
app.setStyle('Fusion')
requestQueue = queue.Queue()
guiQueue = queue.Queue()
window = MainWindow(int(settings['camera-ports']['front']), int(settings['camera-ports']['down']))
u = Unify(requestQueue=requestQueue, guiQueue=guiQueue, interval=10, controls=controls)
try:
os.mkdir('automation-images')
logging.warning('No automation images directory detected; one has been generated for you!')
except FileExistsError:
pass
try:
os.mkdir('captures')
logging.warning('No captures directory detected; one has been generated for you!')
except FileExistsError:
pass
try:
os.mkdir('captures/IMAGES')
logging.warning('No images directory detected; one has been generated for you!')
except FileExistsError:
pass
try:
os.mkdir('captures/VIDEOS')
logging.warning('No videos directory detected; one has been generated for you!')
except FileExistsError:
pass
unify_listener_thread = Thread(target=unify_listener, daemon=True)
unify_listener_thread.start()
print('\033[92m\033[1mSuccessfully loaded Crimson UI\033[0m')
logging.info('Successfully loaded Crimson UI')
window.show()
u.start()
sys.exit(app.exec())