Skip to content

Commit

Permalink
Suppress pylint errors
Browse files Browse the repository at this point in the history
  • Loading branch information
nsubiron committed Dec 22, 2017
1 parent 4956e95 commit 30c5401
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 11 deletions.
5 changes: 2 additions & 3 deletions PythonClient/carla/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

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')

Expand Down Expand Up @@ -96,7 +97,7 @@ def start_episode(self, player_start_index):
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')
Expand Down Expand Up @@ -159,8 +160,6 @@ def _request_new_episode(self, carla_settings):
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
Expand Down
13 changes: 7 additions & 6 deletions PythonClient/carla/planner/map.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,12 +89,13 @@ def get_map(self, height=None):
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."""
Expand Down
14 changes: 12 additions & 2 deletions PythonClient/manual_control.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,17 @@

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')

Expand Down Expand Up @@ -301,7 +311,7 @@ def _on_render(self):
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))
Expand Down

2 comments on commit 30c5401

@mvpcom
Copy link

@mvpcom mvpcom commented on 30c5401 Dec 27, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Something is wrong with this commit. I believe there is a syntax error here.

In python this is not possible:

import numpy as np
from np import *

However, this one works perfectly.

import numpy as np
from numpy import *

This line "from carla_protocol import EpisodeReady" is not working and raise the following error. However, carla_protocol.EpisodeReady() is working great.

from carla_protocol import EpisodeReady
ImportError: No module named 'carla_protocol'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "run_benchmark.py", line 15, in <module>
    from carla.benchmarks.corl_2017 import CoRL2017
    from .benchmark import Benchmark
    from carla.client import VehicleControl
    raise RuntimeError('cannot import "carla_server_pb2.py", run the protobuf compiler to generate this file')
RuntimeError: cannot import "carla_server_pb2.py", run the protobuf compiler to generate this file

@nsubiron
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mvpcom You are right, thanks for the report!

Please sign in to comment.