-
Notifications
You must be signed in to change notification settings - Fork 4
/
car_train.py
35 lines (28 loc) · 840 Bytes
/
car_train.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
import movement
import camera
import os
print("Wait please")
p = 0
tf = 1.6
camera.init()
print("Camera initialized, go ahead!")
while p == 0:
key_press = input('') # previously raw_input()
if key_press == 'w':
os.chdir('/home/pi/Documents/Self-driving-car/images/w')
camera.take_picture()
movement.forward(tf)
elif key_press == 'd':
os.chdir('/home/pi/Documents/Self-driving-car/images/d')
camera.take_picture()
movement.right(tf)
elif key_press == 'a':
os.chdir('/home/pi/Documents/Self-driving-car/images/a')
camera.take_picture()
movement.left(tf)
elif key_press == 'q':
os.chdir('/home/pi/Documents/Self-driving-car/images/q')
camera.take_picture()
elif key_press == 'p':
p = 1
camera.end()