Merge branch 'dev' into issue2
This commit is contained in:
commit
9b409cd56b
22
.travis.yml
22
.travis.yml
|
@ -1,13 +1,27 @@
|
|||
language: python
|
||||
|
||||
os: linux
|
||||
dist: trusty # xenial is not yet supported.
|
||||
|
||||
env: TEST="Pylint"
|
||||
python:
|
||||
- "2.7"
|
||||
- "3.5"
|
||||
- "3.6"
|
||||
|
||||
- "2.7"
|
||||
install:
|
||||
- pip install -r PythonClient/requirements.txt
|
||||
- pip install pylint
|
||||
|
||||
script:
|
||||
- pylint --errors-only --rcfile=PythonClient/.pylintrc PythonClient/carla PythonClient/*.py
|
||||
- pylint --disable=R,C --rcfile=PythonClient/.pylintrc PythonClient/carla PythonClient/*.py
|
||||
|
||||
matrix:
|
||||
include:
|
||||
|
||||
- env: TEST="CppCheck"
|
||||
install: true
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- cppcheck
|
||||
script:
|
||||
- cppcheck Unreal/CarlaUE4/Source Unreal/CarlaUE4/Plugins/Carla/Source Util/ -iUtil/Build -iUtil/CarlaServer/source/carla/server/carla_server.pb.cc --quiet --error-exitcode=1 --enable=warning
|
||||
|
|
|
@ -15,7 +15,7 @@ Reporting bugs
|
|||
--------------
|
||||
|
||||
Use our [issue section](issueslink) on GitHub. Please check before that the
|
||||
issue was not already added.
|
||||
issue is not already reported.
|
||||
|
||||
[issueslink]: https://github.com/carla-simulator/carla/issues
|
||||
|
||||
|
@ -31,10 +31,14 @@ your request as a new issue.
|
|||
Code contributions
|
||||
------------------
|
||||
|
||||
So you are considering making a code contribution, great! we love to have
|
||||
contributions from the community.
|
||||
|
||||
Before starting hands-on on coding, please check out the
|
||||
[projects page][projectslink] to see if we are already working on that. In case
|
||||
of doubt or to discuss how to proceed, please contact one of us (or send an
|
||||
email to carla.simulator@gmail.com).
|
||||
[projects page][projectslink] to see if we are already working on that, it would
|
||||
be a pity putting an effort into something just to discover that someone else
|
||||
was already working on that. In case of doubt or to discuss how to proceed,
|
||||
please contact one of us (or send an email to carla.simulator@gmail.com).
|
||||
|
||||
[projectslink]: https://github.com/carla-simulator/carla/projects/1
|
||||
|
||||
|
@ -42,22 +46,40 @@ email to carla.simulator@gmail.com).
|
|||
|
||||
Check out the ["CARLA Design"](carla_design.md) document to get an idea on the
|
||||
different modules that compose CARLA, and chose the most appropriate one to hold
|
||||
the new feature.
|
||||
the new feature. We are aware the developers documentation is still scarce,
|
||||
please ask us in case of doubt, and of course don't hesitate to improve the
|
||||
current documentation if you feel confident enough.
|
||||
|
||||
#### Coding style
|
||||
#### Coding standard
|
||||
|
||||
Please follow the current coding style when submitting new code.
|
||||
|
||||
###### General
|
||||
|
||||
* Use spaces, not tabs.
|
||||
* Comments should not exceed 80 columns, code may exceed this limit a bit in rare
|
||||
occasions if it results in clearer code.
|
||||
* Avoid adding trailing whitespace as it creates noise in the diffs.
|
||||
* Comments should not exceed 80 columns, code may exceed this limit a bit in rare occasions if it results in clearer code.
|
||||
|
||||
###### Python
|
||||
|
||||
* All code must be compatible with Python 2.7, 3.5, and 3.6.
|
||||
* [Pylint](https://www.pylint.org/) should not give any error or warning (few exceptions apply with external classes like `numpy`, see our `.pylintrc`).
|
||||
* Python code follows [PEP8 style guide](https://www.python.org/dev/peps/pep-0008/) (use `autopep8` whenever possible).
|
||||
* Unreal C++ code, CarlaUE4 and Carla plugin, follow the [Unreal Engine's Coding Standard](https://docs.unrealengine.com/latest/INT/Programming/Development/CodingStandard/) with the exception of using spaces instead of tabs.
|
||||
|
||||
###### C++
|
||||
|
||||
* Compilation should not give any error or warning (`clang++ -Wall -Wextra -std=C++14`).
|
||||
* Unreal C++ code (CarlaUE4 and Carla plugin) follow the [Unreal Engine's Coding Standard](https://docs.unrealengine.com/latest/INT/Programming/Development/CodingStandard/) with the exception of using spaces instead of tabs.
|
||||
* CarlaServer uses [Google's style guide](https://google.github.io/styleguide/cppguide.html).
|
||||
|
||||
#### Pull request
|
||||
#### Pull-requests
|
||||
|
||||
Once you think your contribution is ready to be added to CARLA, please submit a
|
||||
pull request and one of our team members will take a look at it.
|
||||
pull-request to the `dev` branch.
|
||||
|
||||
Try to be as descriptive as possible when filling the pull-request description.
|
||||
|
||||
Please note that there are some checks that the new code is required to pass
|
||||
before we can do the merge. The checks are automatically run by the continuous
|
||||
integration system, you will see a green tick mark if all the checks succeeded.
|
||||
If you see a red mark, please correct your code accordingly.
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
[TYPECHECK]
|
||||
ignored-modules=ConfigParser,numpy,pygame,shutil
|
||||
ignored-classes=_socketobject
|
||||
ignore=carla_server_pb2.py
|
||||
ignored-modules=ConfigParser,numpy,numpy.random,pygame,shutil
|
||||
ignored-classes=_socketobject,EpisodeReady
|
||||
|
|
|
@ -17,7 +17,6 @@ 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')
|
||||
|
||||
|
@ -97,7 +96,7 @@ class CarlaClient(object):
|
|||
data = self._world_client.read()
|
||||
if not data:
|
||||
raise RuntimeError('failed to read data from server')
|
||||
pb_message = EpisodeReady()
|
||||
pb_message = carla_protocol.EpisodeReady()
|
||||
pb_message.ParseFromString(data)
|
||||
if not pb_message.ready:
|
||||
raise RuntimeError('cannot start episode: server failed to start episode')
|
||||
|
@ -160,7 +159,7 @@ class CarlaClient(object):
|
|||
raise RuntimeError('failed to read data from server')
|
||||
pb_message = carla_protocol.SceneDescription()
|
||||
pb_message.ParseFromString(data)
|
||||
self._sensor_names = settings._get_sensor_names(carla_settings)
|
||||
self._sensor_names = settings.get_sensor_names(carla_settings)
|
||||
self._is_episode_requested = True
|
||||
return pb_message
|
||||
|
||||
|
|
|
@ -38,14 +38,14 @@ class CarlaMap(object):
|
|||
city_map_file = os.path.join(dir_path, city + '.png')
|
||||
city_map_file_lanes = os.path.join(dir_path, city + 'Lanes.png')
|
||||
|
||||
with open(city_file, 'r') as file:
|
||||
with open(city_file, 'r') as file_object:
|
||||
|
||||
linewordloffset = file.readline()
|
||||
linewordloffset = file_object.readline()
|
||||
# The offset of the world from the zero coordinates ( The
|
||||
# coordinate we consider zero)
|
||||
self.worldoffset = string_to_floats(linewordloffset)
|
||||
|
||||
lineworldangles = file.readline()
|
||||
lineworldangles = file_object.readline()
|
||||
self.angles = string_to_floats(lineworldangles)
|
||||
|
||||
self.worldrotation = np.array([
|
||||
|
@ -55,14 +55,14 @@ class CarlaMap(object):
|
|||
|
||||
# Ignore for now, these are offsets for map coordinates and scale
|
||||
# (not used).
|
||||
_ = file.readline()
|
||||
linemapoffset = file.readline()
|
||||
_ = file_object.readline()
|
||||
linemapoffset = file_object.readline()
|
||||
|
||||
# The offset of the map zero coordinate.
|
||||
self.mapoffset = string_to_floats(linemapoffset)
|
||||
|
||||
# the graph resolution.
|
||||
linegraphres = file.readline()
|
||||
linegraphres = file_object.readline()
|
||||
self.resolution = string_to_node(linegraphres)
|
||||
|
||||
# The number of game units per pixel.
|
||||
|
|
|
@ -113,7 +113,7 @@ class Image(SensorData):
|
|||
size=(self.width, self.height),
|
||||
data=self.raw_data,
|
||||
decoder_name='raw')
|
||||
b, g, r, a = image.split()
|
||||
b, g, r, _ = image.split()
|
||||
image = PImage.merge("RGB", (r, g, b))
|
||||
|
||||
folder = os.path.dirname(filename)
|
||||
|
|
|
@ -122,18 +122,21 @@ class CarlaSettings(object):
|
|||
return text.getvalue().replace(' = ', '=')
|
||||
|
||||
|
||||
def _get_sensor_names(settings):
|
||||
def get_sensor_names(settings):
|
||||
"""
|
||||
Return a list with the names of the sensors defined in the settings object.
|
||||
The settings object can be a CarlaSettings or an INI formatted string.
|
||||
"""
|
||||
if isinstance(settings, CarlaSettings):
|
||||
# pylint: disable=protected-access
|
||||
return [camera.CameraName for camera in settings._cameras]
|
||||
ini = ConfigParser()
|
||||
if sys.version_info >= (3, 0):
|
||||
ini.readfp(io.StringIO(settings))
|
||||
if sys.version_info >= (3, 2):
|
||||
ini.read_string(settings)
|
||||
elif sys.version_info >= (3, 0):
|
||||
ini.readfp(io.StringIO(settings)) # pylint: disable=deprecated-method
|
||||
else:
|
||||
ini.readfp(io.BytesIO(settings))
|
||||
ini.readfp(io.BytesIO(settings)) # pylint: disable=deprecated-method
|
||||
|
||||
section_name = 'CARLA/SceneCapture'
|
||||
option_name = 'Cameras'
|
||||
|
|
|
@ -39,19 +39,18 @@ class TCPClient(object):
|
|||
try:
|
||||
self._socket = socket.create_connection(address=(self._host, self._port), timeout=self._timeout)
|
||||
self._socket.settimeout(self._timeout)
|
||||
logging.debug(self._logprefix + 'connected')
|
||||
logging.debug('%sconnected', self._logprefix)
|
||||
return
|
||||
except Exception as exception:
|
||||
except OSError as exception:
|
||||
error = exception
|
||||
logging.debug(self._logprefix + 'connection attempt %d: %s', attempt, error)
|
||||
logging.debug('%sconnection attempt %d: %s', self._logprefix, attempt, error)
|
||||
time.sleep(1)
|
||||
continue
|
||||
self._reraise_exception_as_tcp_error('failed to connect', error)
|
||||
|
||||
def disconnect(self):
|
||||
"""Disconnect any active connection."""
|
||||
if self._socket is not None:
|
||||
logging.debug(self._logprefix + 'disconnecting')
|
||||
logging.debug('%sdisconnecting', self._logprefix)
|
||||
self._socket.close()
|
||||
self._socket = None
|
||||
|
||||
|
@ -66,7 +65,7 @@ class TCPClient(object):
|
|||
header = struct.pack('<L', len(message))
|
||||
try:
|
||||
self._socket.sendall(header + message)
|
||||
except Exception as exception:
|
||||
except OSError as exception:
|
||||
self._reraise_exception_as_tcp_error('failed to write data', exception)
|
||||
|
||||
def read(self):
|
||||
|
@ -86,7 +85,7 @@ class TCPClient(object):
|
|||
while length > 0:
|
||||
try:
|
||||
data = self._socket.recv(length)
|
||||
except Exception as exception:
|
||||
except OSError as exception:
|
||||
self._reraise_exception_as_tcp_error('failed to read data', exception)
|
||||
if not data:
|
||||
raise TCPConnectionError(self._logprefix + 'connection closed')
|
||||
|
|
|
@ -53,9 +53,9 @@ else:
|
|||
|
||||
# Workaround for older Python versions.
|
||||
def print_over_same_line(text):
|
||||
line_length = max(print_over_same_line._last_line_length, len(text))
|
||||
line_length = max(print_over_same_line.last_line_length, len(text))
|
||||
empty_space = max(0, line_length - len(text))
|
||||
sys.stdout.write('\r' + text + empty_space * ' ')
|
||||
sys.stdout.flush()
|
||||
print_over_same_line._last_line_length = line_length
|
||||
print_over_same_line._last_line_length = 0
|
||||
print_over_same_line.last_line_length = line_length
|
||||
print_over_same_line.last_line_length = 0
|
||||
|
|
|
@ -13,7 +13,6 @@ from __future__ import print_function
|
|||
import argparse
|
||||
import logging
|
||||
import random
|
||||
import sys
|
||||
import time
|
||||
|
||||
from carla.client import make_carla_client
|
||||
|
@ -213,14 +212,10 @@ def main():
|
|||
settings_filepath=args.carla_settings)
|
||||
|
||||
print('Done.')
|
||||
return
|
||||
|
||||
except TCPConnectionError as error:
|
||||
logging.error(error)
|
||||
time.sleep(1)
|
||||
except Exception as exception:
|
||||
logging.exception(exception)
|
||||
sys.exit(1)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
|
|
@ -30,7 +30,6 @@ from __future__ import print_function
|
|||
import argparse
|
||||
import logging
|
||||
import random
|
||||
import sys
|
||||
import time
|
||||
|
||||
try:
|
||||
|
@ -131,6 +130,8 @@ class CarlaGame(object):
|
|||
self._map = CarlaMap(city_name) if city_name is not None else None
|
||||
self._map_shape = self._map.map_image.shape if city_name is not None else None
|
||||
self._map_view = self._map.get_map(WINDOW_HEIGHT) if city_name is not None else None
|
||||
self._position = None
|
||||
self._agent_positions = None
|
||||
|
||||
def execute(self):
|
||||
"""Launch the PyGame."""
|
||||
|
@ -363,9 +364,6 @@ def main():
|
|||
except TCPConnectionError as error:
|
||||
logging.error(error)
|
||||
time.sleep(1)
|
||||
except Exception as exception:
|
||||
logging.exception(exception)
|
||||
sys.exit(1)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
|
|
@ -102,7 +102,7 @@ private:
|
|||
USceneComponent *SceneRootComponent;
|
||||
|
||||
UPROPERTY(Category = "Map Generation", VisibleAnywhere)
|
||||
float MapScale;
|
||||
float MapScale = 1.0f;
|
||||
|
||||
UPROPERTY(Category = "Meshes", EditAnywhere)
|
||||
TMap<ECityMapMeshTag, UStaticMesh *> StaticMeshes;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
CXX=g++
|
||||
CXX=clang++
|
||||
FLAGS=-Wall -Wextra -std=c++14 -fopenmp
|
||||
LIBS=-lboost_system -lboost_filesystem -lboost_program_options -lpng -ljpeg -ltiff
|
||||
HEADERS=*.h
|
||||
|
|
|
@ -4,9 +4,9 @@ Image Converter
|
|||
Converts output images of depth and semantic segmentation to a prettier format.
|
||||
|
||||
Requires boost_system, boost_filesystem, boost_program_options, libpng, libtiff,
|
||||
libjpeg and openmp.
|
||||
libjpeg and libomp.
|
||||
|
||||
Compile with `g++ -std=c++14 -fopenmp`, for the default compilation just run
|
||||
Compile with `clang++ -std=c++14 -fopenmp`, for the default compilation just run
|
||||
make
|
||||
|
||||
make
|
||||
|
|
Loading…
Reference in New Issue