-
Notifications
You must be signed in to change notification settings - Fork 0
/
ControlsDemo.py
51 lines (46 loc) · 1.67 KB
/
ControlsDemo.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
from BaseLibrary.Code.Server.Motor import *
import time
PWM = Motor()
try:
while True:
a = input()
if a == 'w':
PWM.setMotorModel(1100, 1100, 1000, 1000)
elif a == 'a':
PWM.setMotorModel(-1900, -1500, 2000, 2000)
elif a == 's':
PWM.setMotorModel(-1450, -1450, -1450, -1450)
elif a == 'd':
PWM.setMotorModel(2000, 2000, -2500, -1500)
elif a == 'q':
PWM.setMotorModel(600, 600, 1300, 1300) # slight left
elif a == 'e':
PWM.setMotorModel(1510, 1510, 600, 600) # slight right
elif a == 'j':
PWM.setMotorModel(600, 600, 1600, 1600) # more left
elif a == 'l':
PWM.setMotorModel(2000, 2000, 600, 600) # more right
elif a == '3':
PWM.setMotorModel(-1900,-1500,2000,2000)
time.sleep(1.78)
PWM.setMotorModel(0,0,0,0)
elif a == '1':
PWM.setMotorModel(2800, 2800, 550, 550) # extremely right
elif a == '2':
PWM.setMotorModel(550, 550, 2800, 2800) # extremely left
elif a == 'z':
PWM.setMotorModel(2000, 2000, -2500, -1500)
time.sleep(0.25)
PWM.setMotorModel(1450, 1450, 1450, 1450)
time.sleep(1)
PWM.setMotorModel(-1900, -1500, 2000, 2000)
time.sleep(0.5)
PWM.setMotorModel(1450, 1450, 1450, 1450)
time.sleep(1)
PWM.setMotorModel(2000, 2000, -2500, -1500)
time.sleep(0.25)
PWM.setMotorModel(0, 0, 0, 0)
else:
PWM.setMotorModel(0, 0, 0, 0)
except KeyboardInterrupt:
PWM.setMotorModel(0, 0, 0, 0)