-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathperception.py
More file actions
39 lines (31 loc) · 996 Bytes
/
Copy pathperception.py
File metadata and controls
39 lines (31 loc) · 996 Bytes
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
import numpy as np
from Robot import Robot
from automotive import *
HOST = '10.127.50.72'
PORT = 10099
Fred = Robot(HOST, PORT)
while True:
sensors_data = Fred.get_sensor_data()
left, right, disp = sensors_data['left'], sensors_data['right'], sensors_data['disp']
disp = disp.astype(np.uint8)
cv.imshow('disp', cv.applyColorMap(disp, cv.COLORMAP_RAINBOW))
cv.imshow('stacked', np.hstack((left, right)))
key = cv.waitKey(25)
try:
if key == ord('q'):
break
elif key == ord('a'):
Fred.rotate_head(yaw=5)
elif key == ord('d'):
Fred.rotate_head(yaw=-5)
elif key == ord('s'):
Fred.rotate_head(pitch=5)
elif key == ord('w'):
Fred.rotate_head(pitch=-5)
elif key == ord('p'):
watch_on_target(Fred)
elif key == ord('o'):
watch_on_box(Fred)
except BrokenPipeError:
print('broken pipe')
Fred.start_socket_shit()