Merge pull request #104 from carla-simulator/travis-ci-support

Travis-ci support
This commit is contained in:
Néstor Subirón 2017-12-22 16:24:41 +01:00 committed by GitHub
commit fdf5409ad6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 41 additions and 11 deletions

13
.travis.yml Normal file
View File

@ -0,0 +1,13 @@
language: python
python:
- "2.7"
- "3.5"
- "3.6"
install:
- pip install -r PythonClient/requirements.txt
- pip install pylint
script:
- pylint --errors-only --rcfile=PythonClient/.pylintrc PythonClient/carla PythonClient/*.py

3
PythonClient/.pylintrc Normal file
View File

@ -0,0 +1,3 @@
[TYPECHECK]
ignored-modules=ConfigParser,numpy,pygame,shutil
ignored-classes=_socketobject

View File

@ -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

View File

@ -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."""

View File

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

View File

@ -0,0 +1,4 @@
Pillow
numpy
protobuf
pygame