-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathmain.py
40 lines (35 loc) · 842 Bytes
/
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
from motion import line_follower as lf
from motion import movement
import time
m = movement.Movement()
def main():
tick = time.time()
while True:
try:
if time.time() - tick > 12:
m.hold()
time.sleep(2)
break
else:
m.hp_control(90)
m.forward(150)
except Exception as e:
print(e)
m.hold()
break
while True:
print('\n<--------------------->')
try:
lf.run()
except KeyboardInterrupt:
lf.tearDown()
m.hold()
print('Manual Stop')
break
except Exception as e:
lf.tearDown()
m.hold()
print(e)
break
if __name__ == "__main__":
main()