From ea6a711559bd8d2d04ed55af1a837700a4869d4d Mon Sep 17 00:00:00 2001 From: nsubiron Date: Sat, 18 Nov 2017 18:34:42 +0100 Subject: [PATCH] #32 Small fixes --- PythonClient/client_example.py | 6 ++---- PythonClient/manual_control.py | 3 ++- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/PythonClient/client_example.py b/PythonClient/client_example.py index c5b8e4644..cea25e55a 100755 --- a/PythonClient/client_example.py +++ b/PythonClient/client_example.py @@ -13,7 +13,6 @@ from __future__ import print_function import argparse import logging import random -import shutil import sys import time @@ -21,6 +20,7 @@ import time from carla.client import make_carla_client from carla.settings import CarlaSettings, Camera from carla.tcp import TCPConnectionError +from carla.util import print_over_same_line def run_carla_client(host, port, autopilot_on, save_images_to_disk, image_filename_format, settings): @@ -140,9 +140,7 @@ def print_player_measurements(player_measurements): speed=player_measurements.forward_speed, other_lane=100 * player_measurements.intersection_otherlane, offroad=100 * player_measurements.intersection_offroad) - empty_space = shutil.get_terminal_size((80, 20)).columns - len(message) - sys.stdout.write('\r' + message + empty_space * ' ') - sys.stdout.flush() + print_over_same_line(message) def main(): diff --git a/PythonClient/manual_control.py b/PythonClient/manual_control.py index cbcda8557..0efb38441 100755 --- a/PythonClient/manual_control.py +++ b/PythonClient/manual_control.py @@ -140,6 +140,7 @@ class CarlaGame(object): player_start = np.random.randint(number_of_player_starts) self.client.start_episode(player_start) self._timer = Timer() + self._is_on_reverse = False def _on_loop(self): self._timer.tick() @@ -220,7 +221,7 @@ class CarlaGame(object): def main(): - argparser = argparse.ArgumentParser(description=__doc__) + argparser = argparse.ArgumentParser(description='CARLA Manual Control Client') argparser.add_argument( '-v', '--verbose', action='store_true',