diff --git a/PythonClient/carla/client.py b/PythonClient/carla/client.py index 748200928..fedf0e490 100644 --- a/PythonClient/carla/client.py +++ b/PythonClient/carla/client.py @@ -17,6 +17,7 @@ from . import util try: from . import carla_server_pb2 as carla_protocol + from carla_protocol import EpisodeReady except ImportError: raise RuntimeError('cannot import "carla_server_pb2.py", run the protobuf compiler to generate this file') @@ -96,7 +97,7 @@ class CarlaClient(object): data = self._world_client.read() if not data: raise RuntimeError('failed to read data from server') - pb_message = carla_protocol.EpisodeReady() + pb_message = EpisodeReady() pb_message.ParseFromString(data) if not pb_message.ready: raise RuntimeError('cannot start episode: server failed to start episode') @@ -159,8 +160,6 @@ class CarlaClient(object): raise RuntimeError('failed to read data from server') pb_message = carla_protocol.SceneDescription() pb_message.ParseFromString(data) - if len(pb_message.player_start_spots) < 1: - raise RuntimeError("received 0 player start spots") self._sensor_names = settings._get_sensor_names(carla_settings) self._is_episode_requested = True return pb_message diff --git a/PythonClient/carla/planner/map.py b/PythonClient/carla/planner/map.py index 142fc2a14..22c651118 100644 --- a/PythonClient/carla/planner/map.py +++ b/PythonClient/carla/planner/map.py @@ -89,12 +89,13 @@ class CarlaMap(object): return np.fliplr(self.map_image) def get_map_lanes(self, height=None): - if size is not None: - img = Image.fromarray(self.map_image_lanes.astype(np.uint8)) - img = img.resize((size[1], size[0]), Image.ANTIALIAS) - img.load() - return np.fliplr(np.asarray(img, dtype="int32")) - return np.fliplr(self.map_image_lanes) + # if size is not None: + # img = Image.fromarray(self.map_image_lanes.astype(np.uint8)) + # img = img.resize((size[1], size[0]), Image.ANTIALIAS) + # img.load() + # return np.fliplr(np.asarray(img, dtype="int32")) + # return np.fliplr(self.map_image_lanes) + raise NotImplementedError def get_position_on_map(self, world): """Get the position on the map for a certain world position.""" diff --git a/PythonClient/manual_control.py b/PythonClient/manual_control.py index 6933747ce..329d831a0 100755 --- a/PythonClient/manual_control.py +++ b/PythonClient/manual_control.py @@ -35,7 +35,17 @@ import time try: import pygame - from pygame.locals import * + from pygame.locals import K_DOWN + from pygame.locals import K_LEFT + from pygame.locals import K_RIGHT + from pygame.locals import K_SPACE + from pygame.locals import K_UP + from pygame.locals import K_a + from pygame.locals import K_d + from pygame.locals import K_q + from pygame.locals import K_r + from pygame.locals import K_s + from pygame.locals import K_w except ImportError: raise RuntimeError('cannot import pygame, make sure pygame package is installed') @@ -301,7 +311,7 @@ class CarlaGame(object): agent.vehicle.transform.location.y, agent.vehicle.transform.location.z]) w_pos = int(agent_position[0]*(float(WINDOW_HEIGHT)/float(self._map_shape[0]))) - h_pos =int(agent_position[1] *(new_window_width/float(self._map_shape[1]))) + h_pos =int(agent_position[1] *(new_window_width/float(self._map_shape[1]))) pygame.draw.circle(surface, [255, 0, 255, 255], (w_pos,h_pos), 4, 0) self._display.blit(surface, (WINDOW_WIDTH, 0))