-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.py
55 lines (50 loc) · 949 Bytes
/
app.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
from inputs import get_gamepad
from controller import Controller
from rasp_tank import RaspTank
gamepad = Controller()
# robot initialization
motor_left = {
'pwm': 4,
'pin1': 14,
'pin2': 15
}
motor_right = {
'pwm': 17,
'pin1': 27,
'pin2': 18
}
servos = {
'arm1': {
'channel': 12,
'min': 100,
'max': 430
},
'arm2': {
'channel': 13,
'min': 100,
'max': 430
},
'arm3': {
'channel': 14,
'min': 150,
'max': 450
},
'arm4': {
'channel': 15,
'min': 150,
'max': 301
},
'front': {
'channel': 11,
'min': 150,
'max': 301
}
}
tank = RaspTank(motor_left, motor_right, servos)
while True:
events = get_gamepad()
for event in events:
if event.ev_type == 'Sync':
continue
event = gamepad.handle_event(event)
tank.handle_event(event)