Skip to content

Commit

Permalink
Merge branch 'com' into roads
Browse files Browse the repository at this point in the history
  • Loading branch information
nsubiron committed Oct 19, 2018
2 parents 2e7ce9b + b665fa1 commit 81e7fbc
Show file tree
Hide file tree
Showing 164 changed files with 9,283 additions and 1,941 deletions.
29 changes: 14 additions & 15 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,20 @@ matrix:
- python3
- python3-pip
- libboost-python-dev
- libtiff5-dev
- libjpeg-dev
install:
- pip2 install --user setuptools nose2
- pip3 install --user setuptools nose2
- make setup
- pip2 install -q --user setuptools nose2
- pip3 install -q --user setuptools nose2
script:
- make setup >/dev/null
- make LibCarla >/dev/null
- make PythonAPI >/dev/null
- while sleep 2m; do echo "still building..."; done &
- make setup > build.log 2>&1
- make LibCarla > build.log 2>&1
- make PythonAPI > build.log 2>&1
- kill %1
- make check ARGS="--all --gtest_args=--gtest_filter=-*_mt"
after_failure:
- tail --lines=2000 build.log

- env: TEST="Pylint 2"
addons:
Expand All @@ -40,22 +45,16 @@ matrix:
- python
- python-pip
install:
- pip2 install --user -r PythonClient/requirements.txt
- pip2 install --user pylint
- pip2 install -q --user -r PythonClient/requirements.txt
- pip2 install -q --user pylint
script:
- pylint --disable=R,C --rcfile=PythonClient/.pylintrc PythonClient/carla PythonClient/*.py

- env: TEST="MkDocs"
install:
- pip install --user mkdocs
- pip install -q --user mkdocs
script:
- mkdocs build --verbose --clean --strict --site-dir _site

- env: TEST="AwesomeBot"
install:
- gem install awesome_bot
script:
- find . -name '*.md' | xargs awesome_bot --allow-dupe --allow-redirect --skip-save-results

notifications:
email: false
2 changes: 1 addition & 1 deletion Docs/how_to_build_on_linux.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Install the build tools and dependencies
```
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt-get update
sudo apt-get install build-essential clang-5.0 lld-5.0 g++-7 ninja-build python python-pip python-dev tzdata sed curl wget unzip autoconf libtool
sudo apt-get install build-essential clang-5.0 lld-5.0 g++-7 ninja-build python python-pip python-dev libpng16-dev libtiff5-dev libjpeg-dev tzdata sed curl wget unzip autoconf libtool
pip install --user setuptools nose2
```

Expand Down
47 changes: 46 additions & 1 deletion Docs/python_api.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,17 @@
- `set_timeout(float_seconds)`
- `get_client_version()`
- `get_server_version()`
- `ping()`
- `get_world()`

## `carla.World`

- `id`
- `map_name`
- `get_blueprint_library()`
- `get_spectator()`
- `get_weather()`
- `set_weather(weather_parameters)`
- `get_actors()`
- `spawn_actor(blueprint, transform, attach_to=None)`
- `try_spawn_actor(blueprint, transform, attach_to=None)`

Expand Down Expand Up @@ -60,25 +64,39 @@
- `__float__()`
- `__str__()`

## `carla.ActorList`

- `filter(wildcard_pattern)`
- `__getitem__(pos)`
- `__len__()`
- `__iter__()`

## `carla.Actor`

- `id`
- `type_id`
- `bounding_box`
- `is_alive`
- `get_world()`
- `get_location()`
- `get_transform()`
- `get_velocity()`
- `get_acceleration()`
- `set_location(location)`
- `set_transform(transform)`
- `destroy()`

## `carla.Vehicle(carla.Actor)`

- `control`
- `apply_control(vehicle_control)`
- `set_autopilot(enabled=True)`

## `carla.Sensor(carla.Actor)`

- `is_listening`
- `listen(callback_function)`
- `stop()`

## `carla.Image`

Expand All @@ -89,8 +107,12 @@
- `type`
- `fov`
- `raw_data`
- `convert(color_converter)`
- `save_to_disk(path, color_converter=None)`
- `__len__()`
- `__iter__()`
- `__getitem__(pos)`
- `__setitem__(pos, color)`

## `carla.LidarMeasurement`

Expand All @@ -100,8 +122,11 @@
- `channels`
- `raw_data`
- `get_point_count(channel)`
- `save_to_disk(path)`
- `__len__()`
- `__iter__()`
- `__getitem__(pos)`
- `__setitem__(pos, location)`

## `carla.VehicleControl`

Expand All @@ -110,6 +135,19 @@
- `brake`
- `hand_brake`
- `reverse`
- `__eq__()`
- `__ne__()`

## `carla.WeatherParameters`

- `cloudyness`
- `precipitation`
- `precipitation_deposits`
- `wind_intensity`
- `sun_azimuth_angle`
- `sun_altitude_angle`
- `__eq__()`
- `__ne__()`

## `carla.Location`

Expand All @@ -134,3 +172,10 @@
- `g`
- `b`
- `a`

## `carla.ColorConverter`

- `None`
- `Depth`
- `LogarithmicDepth`
- `CityScapesPalette`
5 changes: 5 additions & 0 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@ pipeline {
sh 'make PythonAPI'
sh 'make CarlaUE4Editor'
}
post {
always {
archiveArtifacts 'PythonAPI/dist/*.egg'
}
}
}

stage('Unit Tests') {
Expand Down
29 changes: 26 additions & 3 deletions LibCarla/cmake/client/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,24 @@ file(GLOB libcarla_carla_client_sources
set(libcarla_sources "${libcarla_sources};${libcarla_carla_client_sources}")
install(FILES ${libcarla_carla_client_sources} DESTINATION include/carla/client)

file(GLOB libcarla_carla_client_detail_sources
"${libcarla_source_path}/carla/client/detail/*.cpp"
"${libcarla_source_path}/carla/client/detail/*.h")
set(libcarla_sources "${libcarla_sources};${libcarla_carla_client_detail_sources}")
install(FILES ${libcarla_carla_client_detail_sources} DESTINATION include/carla/client/detail)

file(GLOB libcarla_carla_geom_sources
"${libcarla_source_path}/carla/geom/*.cpp"
"${libcarla_source_path}/carla/geom/*.h")
set(libcarla_sources "${libcarla_sources};${libcarla_carla_geom_sources}")
install(FILES ${libcarla_carla_geom_sources} DESTINATION include/carla/geom)

file(GLOB libcarla_carla_image_sources
"${libcarla_source_path}/carla/image/*.cpp"
"${libcarla_source_path}/carla/image/*.h")
set(libcarla_sources "${libcarla_sources};${libcarla_carla_image_sources}")
install(FILES ${libcarla_carla_image_sources} DESTINATION include/carla/image)

file(GLOB libcarla_carla_opendrive_sources
"${libcarla_source_path}/carla/opendrive/*.cpp"
"${libcarla_source_path}/carla/opendrive/*.h")
Expand Down Expand Up @@ -70,6 +82,18 @@ file(GLOB libcarla_carla_opendrive_logic_sources
set(libcarla_sources "${libcarla_sources};${libcarla_carla_opendrive_logic_sources}")
install(FILES ${libcarla_carla_opendrive_logic_sources} DESTINATION include/carla/opendrive/logic)

file(GLOB libcarla_carla_pointcloud_sources
"${libcarla_source_path}/carla/pointcloud/*.cpp"
"${libcarla_source_path}/carla/pointcloud/*.h")
set(libcarla_sources "${libcarla_sources};${libcarla_carla_pointcloud_sources}")
install(FILES ${libcarla_carla_pointcloud_sources} DESTINATION include/carla/pointcloud)

file(GLOB libcarla_carla_profiler_sources
"${libcarla_source_path}/carla/profiler/*.cpp"
"${libcarla_source_path}/carla/profiler/*.h")
set(libcarla_sources "${libcarla_sources};${libcarla_carla_profiler_sources}")
install(FILES ${libcarla_carla_profiler_sources} DESTINATION include/carla/profiler)

file(GLOB libcarla_carla_road_sources
"${libcarla_source_path}/carla/road/*.cpp"
"${libcarla_source_path}/carla/road/*.h")
Expand Down Expand Up @@ -146,13 +170,12 @@ foreach(target carla_client_debug carla_client)
"${BOOST_INCLUDE_PATH}"
"${RPCLIB_INCLUDE_PATH}")

# @todo This was disabled because now everything is built in the setup.py.
# install(TARGETS ${target} DESTINATION lib)
install(TARGETS ${target} DESTINATION lib)
endforeach(target)

# Specific options for debug.
set_target_properties(carla_client_debug PROPERTIES COMPILE_FLAGS ${CMAKE_CXX_FLAGS_DEBUG})
target_compile_definitions(carla_client_debug PUBLIC -DBOOST_ASIO_ENABLE_BUFFER_DEBUGGING)

# Specific options for release.
set_target_properties(carla_client PROPERTIES COMPILE_FLAGS ${CMAKE_CXX_FLAGS_RELEASE})
set_target_properties(carla_client PROPERTIES COMPILE_FLAGS ${CMAKE_CXX_FLAGS_RELEASE_CLIENT})
3 changes: 3 additions & 0 deletions LibCarla/cmake/server/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ install(FILES ${libcarla_carla_headers} DESTINATION include/carla)
file(GLOB libcarla_carla_geom_headers "${libcarla_source_path}/carla/geom/*.h")
install(FILES ${libcarla_carla_geom_headers} DESTINATION include/carla/geom)

file(GLOB libcarla_carla_profiler_headers "${libcarla_source_path}/carla/profiler/*.h")
install(FILES ${libcarla_carla_profiler_headers} DESTINATION include/carla/profiler)

file(GLOB libcarla_carla_rpc_headers "${libcarla_source_path}/carla/rpc/*.h")
install(FILES ${libcarla_carla_rpc_headers} DESTINATION include/carla/rpc)

Expand Down
40 changes: 40 additions & 0 deletions LibCarla/source/carla/AtomicSharedPtr.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
// Copyright (c) 2017 Computer Vision Center (CVC) at the Universitat Autonoma
// de Barcelona (UAB).
//
// This work is licensed under the terms of the MIT license.
// For a copy, see <https://opensource.org/licenses/MIT>.

#pragma once

#include "carla/NonCopyable.h"

#include <memory>

namespace carla {

/// A very simple atomic shared ptr with relaxed memory order.
template <typename T>
class AtomicSharedPtr : private NonCopyable {
public:

template <typename... Args>
explicit AtomicSharedPtr(Args &&... args) : _ptr(std::forward<Args>(args)...) {}

void store(std::shared_ptr<T> ptr) {
std::atomic_store_explicit(&_ptr, ptr, std::memory_order_relaxed);
}

std::shared_ptr<T> load() const {
return std::atomic_load_explicit(&_ptr, std::memory_order_relaxed);
}

void operator=(std::shared_ptr<T> ptr) {
store(std::move(ptr));
}

private:

std::shared_ptr<T> _ptr;
};

} // namespace carla
1 change: 1 addition & 0 deletions LibCarla/source/carla/Debug.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#endif // NDEBUG

#define DEBUG_ASSERT(predicate) DEBUG_ONLY(assert(predicate));
#define DEBUG_ERROR DEBUG_ASSERT(false);

#ifdef LIBCARLA_WITH_GTEST
# include <gtest/gtest.h>
Expand Down
26 changes: 26 additions & 0 deletions LibCarla/source/carla/FileSystem.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// Copyright (c) 2017 Computer Vision Center (CVC) at the Universitat Autonoma
// de Barcelona (UAB).
//
// This work is licensed under the terms of the MIT license.
// For a copy, see <https://opensource.org/licenses/MIT>.

#include "carla/FileSystem.h"

#include <boost/filesystem/operations.hpp>

namespace carla {

void FileSystem::ValidateFilePath(std::string &filepath, const std::string &ext) {
namespace fs = boost::filesystem;
fs::path path(filepath);
if (path.extension().empty() && !ext.empty()) {
if (ext[0] != '.') {
path += '.';
}
path += ext;
}
fs::create_directories(path.parent_path());
filepath = path.string();
}

} // namespace carla
29 changes: 29 additions & 0 deletions LibCarla/source/carla/FileSystem.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
// Copyright (c) 2017 Computer Vision Center (CVC) at the Universitat Autonoma
// de Barcelona (UAB).
//
// This work is licensed under the terms of the MIT license.
// For a copy, see <https://opensource.org/licenses/MIT>.

#pragma once

#include <string>

namespace carla {

/// Static functions for accessing the file system.
///
/// @warning Using this file requires linking against boost_filesystem.
class FileSystem {
public:

/// Convenient function to validate a path before creating a file.
///
/// 1) Ensures all the parent directories are created if missing.
/// 2) If @a filepath is missing the extension, @a default_extension is
/// appended to the path.
static void ValidateFilePath(
std::string &filepath,
const std::string &default_extension = "");
};

} // namespace carla
12 changes: 6 additions & 6 deletions LibCarla/source/carla/Memory.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,18 @@

namespace carla {

// Use this SharedPtr (boost::shared_ptr) to keep compatibility with
// boost::python, but it would be nice if in the future we can make a Python
// adaptor for std::shared_ptr.
/// Use this SharedPtr (boost::shared_ptr) to keep compatibility with
/// boost::python, but it would be nice if in the future we can make a Python
/// adaptor for std::shared_ptr.
template <typename T>
using SharedPtr = boost::shared_ptr<T>;

template <typename T>
using EnableSharedFromThis = boost::enable_shared_from_this<T>;

template <typename T, typename ... Args>
static inline auto MakeShared(Args && ... args) {
return boost::make_shared<T>(std::forward<Args>(args) ...);
template <typename T, typename... Args>
static inline auto MakeShared(Args &&... args) {
return boost::make_shared<T>(std::forward<Args>(args)...);
}

} // namespace carla
Loading

0 comments on commit 81e7fbc

Please sign in to comment.