From 7f194f57f2b86a083ad7607a2f2ee71ede9b7bdd Mon Sep 17 00:00:00 2001 From: Simon Pirkelmann Date: Sat, 24 Oct 2020 20:05:00 +0200 Subject: [PATCH] added python3 support --- remote_control/keyboard_controller.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/remote_control/keyboard_controller.py b/remote_control/keyboard_controller.py index 770e8f2..9e47cb7 100644 --- a/remote_control/keyboard_controller.py +++ b/remote_control/keyboard_controller.py @@ -28,27 +28,27 @@ while running: if event.key == pygame.K_LEFT: u1 = -vmax u2 = vmax - print("turn left: ({},{})".format(u1, u2)) + print(f"turn left: ({u1},{u2})") elif event.key == pygame.K_RIGHT: u1 = vmax u2 = -vmax - print("turn right: ({},{})".format(u1, u2)) + print(f"turn right: ({u1},{u2})") elif event.key == pygame.K_UP: u1 = vmax u2 = vmax - print("forward: ({},{})".format(u1, u2)) + print(f"forward: ({u1},{u2})") elif event.key == pygame.K_DOWN: u1 = -vmax u2 = -vmax - print("backward: ({},{})".format(u1, u2)) + print(f"backward: ({u1},{u2})") elif event.key == pygame.K_ESCAPE: print("quit") - running = False + running = False u1 = 0.0 u2 = 0.0 - rc_socket.send('({},{})\n'.format(u1, u2)) + rc_socket.send(f'({u1},{u2})\n'.encode()) elif event.type == pygame.KEYUP: print("key released, resetting: ({},{})".format(u1, u2)) - rc_socket.send('({},{})\n'.format(u1, u2)) + rc_socket.send(f'({u1},{u2})\n'.encode())