This commit is contained in:
2024-12-28 20:03:55 +01:00
parent 064fc6befa
commit 9efa31daf8

View File

@@ -27,7 +27,22 @@ FORWARD = {
11: (110, 10, 90), 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), 0: (0, 110, 70),
1: (0, 110, 70), 1: (0, 110, 70),
2: (0, 110, 70), 2: (0, 110, 70),
@@ -42,7 +57,7 @@ ROTATE_RIGHT = { # Placeholder, update values later
11: (10, 170, 90), 11: (10, 170, 90),
} }
ROTATE_LEFT = { # Placeholder, update values later ROTATE_LEFT = {
0: (0, 110, 70), 0: (0, 110, 70),
1: (0, 110, 70), 1: (0, 110, 70),
2: (0, 110, 70), 2: (0, 110, 70),
@@ -129,7 +144,7 @@ def is_input_available():
# Main execution # Main execution
if __name__ == "__main__": 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() command_queue = queue.Queue()
@@ -137,7 +152,7 @@ if __name__ == "__main__":
while True: while True:
if is_input_available(): if is_input_available():
input_char = sys.stdin.read(1).strip() 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) command_queue.put(input_char)
elif input_char == 'q': elif input_char == 'q':
print("Exiting...") print("Exiting...")
@@ -157,7 +172,11 @@ if __name__ == "__main__":
print("Executing RIGHT movement...") print("Executing RIGHT movement...")
group_1(ROTATE_RIGHT) group_1(ROTATE_RIGHT)
group_2(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 time.sleep(0.1) # Idle loop
except KeyboardInterrupt: except KeyboardInterrupt:
print("\nProgram terminated.") print("\nProgram terminated.")