-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMain.py
54 lines (35 loc) · 986 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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#!/usr/bin/env python
# coding: utf-8
# In[ ]:
import import_ipynb
from configure import ConnType,InputType
import GamepadInput
import KeyboardInput
from Algo import Algo
from Actuate import Actuate
def main():
val = input("Enter Connection Type: 0:KEYBOARD (DEFAULT) 1.JOYSTICK")
print(val)
if int(val)==1:
print("if")
Ci = GamepadInput.GamepadInput()
else:
print("else")
Ci = KeyboardInput.KeyboardInput()
alg = Algo()
act = Actuate()
while True:
Ci.readInput()
alg.run(Ci.getInput())
dir=alg.get_dir()
spd=alg.get_speed()
if not any ([dir,spd]):
act.pinCleanup()
break
else:
act.setDirection(alg.get_dir())
act.setSpeed(alg.get_speed())
if __name__ == "__main__":
print("hello")
main()
# In[ ]: