-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconsole_controller.py
More file actions
38 lines (33 loc) · 831 Bytes
/
console_controller.py
File metadata and controls
38 lines (33 loc) · 831 Bytes
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
# Import
from platform.mecanum import MecanumPlatform
from time import sleep
from sys import stdin
# Main
if __name__ == "__main__":
print("=== Console controller ===")
print("Commands: forward, back, left, right, rotate_left, rotate_right, stop, quit\n")
robot = MecanumPlatform ()
print "\nEnter command:"
while(True):
command = stdin.readline()
command = command[:-1]
if command == "forward":
robot.Move(40)
elif command == "back":
robot.Move(-40)
elif command == "left":
robot.Left(30)
elif command == "right":
robot.Right(30)
elif command == "rotate_left":
robot.RotateLeft(20)
elif command == "rotate_right":
robot.RotateRight(20)
elif command == "stop":
robot.Stop()
elif command =="quit":
robot.Stop()
break
else:
print ("Wrong command")
print("DONE.")