-
Notifications
You must be signed in to change notification settings - Fork 3
/
centerline.py
47 lines (38 loc) · 1.14 KB
/
centerline.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
def center_line(video_capture,junction):
row = v_feed(video_capture)
goForward(37)
sleep(1.8)
if junction == 'T junction left':
row = v_feed(video_capture)
while row[3] == 1:
print("onl")
turnLeft(30)
sleep(0.05)
row = v_feed(video_capture)
# row = v_feed(video_capture)
while row[3] != 1:
print("ol")
turnLeft(30)
sleep(0.05)
row = v_feed(video_capture)
elif junction == 'right right junction':
# while row[3] == 1:
# turnRight(30)
# sleep(0.05)
# row = v_feed(video_capture)
row = v_feed(video_capture)
while row[3] != 1:
turnRight(30)
sleep(0.05)
row = v_feed(video_capture)
elif junction == 'left right junction':
# while row[3] == 1:
# turnLeft(30)
# sleep(0.05)
# row = v_feed(video_capture)
row = v_feed(video_capture)
while row[3] != 1:
turnLeft(30)
sleep(0.05)
row = v_feed(video_capture)
stop()