a
This commit is contained in:
29
walk2.py
29
walk2.py
@@ -27,7 +27,22 @@ FORWARD = {
|
||||
11: (110, 10, 90),
|
||||
}
|
||||
|
||||
ROTATE_RIGHT = { # Placeholder, update values later
|
||||
BACK = {
|
||||
0: (0, 110, 70),
|
||||
1: (0, 110, 70),
|
||||
2: (0, 110, 70),
|
||||
3: (0, 110, 70),
|
||||
4: (0, 110, 70),
|
||||
5: (0, 110, 70),
|
||||
6: (110, 10, 90),
|
||||
7: (120, 10, 65),
|
||||
8: (170, 70, 90),
|
||||
9: (70, 170, 90),
|
||||
10: (10, 120, 65),
|
||||
11: (10, 110, 90),
|
||||
}
|
||||
|
||||
ROTATE_RIGHT = {
|
||||
0: (0, 110, 70),
|
||||
1: (0, 110, 70),
|
||||
2: (0, 110, 70),
|
||||
@@ -42,7 +57,7 @@ ROTATE_RIGHT = { # Placeholder, update values later
|
||||
11: (10, 170, 90),
|
||||
}
|
||||
|
||||
ROTATE_LEFT = { # Placeholder, update values later
|
||||
ROTATE_LEFT = {
|
||||
0: (0, 110, 70),
|
||||
1: (0, 110, 70),
|
||||
2: (0, 110, 70),
|
||||
@@ -129,7 +144,7 @@ def is_input_available():
|
||||
|
||||
# Main execution
|
||||
if __name__ == "__main__":
|
||||
print("Press 'w' for FORWARD, 'a' for LEFT, 'd' for RIGHT. Press 'q' to quit.")
|
||||
print("Press 'w' for FORWARD, 'a' for LEFT, 'd' for RIGHT, 's' for BACK. Press 'q' to quit.")
|
||||
|
||||
command_queue = queue.Queue()
|
||||
|
||||
@@ -137,7 +152,7 @@ if __name__ == "__main__":
|
||||
while True:
|
||||
if is_input_available():
|
||||
input_char = sys.stdin.read(1).strip()
|
||||
if input_char in ['w', 'a', 'd']:
|
||||
if input_char in ['w', 'a', 'd', 's']:
|
||||
command_queue.put(input_char)
|
||||
elif input_char == 'q':
|
||||
print("Exiting...")
|
||||
@@ -157,7 +172,11 @@ if __name__ == "__main__":
|
||||
print("Executing RIGHT movement...")
|
||||
group_1(ROTATE_RIGHT)
|
||||
group_2(ROTATE_RIGHT)
|
||||
elif command == 's':
|
||||
print("Executing BACK movement...")
|
||||
group_1(BACK)
|
||||
group_2(BACK)
|
||||
|
||||
time.sleep(0.1) # Idle loop
|
||||
except KeyboardInterrupt:
|
||||
print("\nProgram terminated.")
|
||||
print("\nProgram terminated.")
|
||||
Reference in New Issue
Block a user