Merge branch 'master' into com

This commit is contained in:
nsubiron 2018-10-26 17:29:59 +02:00
commit 4e075ca1f1
88 changed files with 120 additions and 87 deletions

2
.gitignore vendored
View File

@ -1,7 +1,7 @@
Build Build
Dist Dist
Doxygen Doxygen
PythonClient/dist Deprecated/PythonClient/dist
Util/Build Util/Build
Install Install

View File

@ -45,10 +45,10 @@ matrix:
- python - python
- python-pip - python-pip
install: install:
- pip2 install -q --user -r PythonClient/requirements.txt - pip2 install -q --user -r Deprecated/PythonClient/requirements.txt
- pip2 install -q --user pylint - pip2 install -q --user pylint
script: script:
- pylint --disable=R,C --rcfile=PythonClient/.pylintrc PythonClient/carla PythonClient/*.py - pylint --disable=R,C --rcfile=Deprecated/PythonClient/.pylintrc Deprecated/PythonClient/carla Deprecated/PythonClient/*.py
- env: TEST="MkDocs" - env: TEST="MkDocs"
install: install:

View File

Before

Width:  |  Height:  |  Size: 534 KiB

After

Width:  |  Height:  |  Size: 534 KiB

View File

Before

Width:  |  Height:  |  Size: 27 KiB

After

Width:  |  Height:  |  Size: 27 KiB

View File

Before

Width:  |  Height:  |  Size: 33 KiB

After

Width:  |  Height:  |  Size: 33 KiB

View File

Before

Width:  |  Height:  |  Size: 175 KiB

After

Width:  |  Height:  |  Size: 175 KiB

View File

Before

Width:  |  Height:  |  Size: 400 KiB

After

Width:  |  Height:  |  Size: 400 KiB

View File

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 10 KiB

View File

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 15 KiB

View File

@ -274,7 +274,7 @@ class PointCloud(SensorData):
# Open the file and save with the specific PLY format. # Open the file and save with the specific PLY format.
with open(filename, 'w+') as ply_file: with open(filename, 'w+') as ply_file:
ply_file.write('\n'.join([construct_ply_header(), ply])) ply_file.write('\n'.join([construct_ply_header(), ply, '']))
def __len__(self): def __len__(self):
return len(self.array) return len(self.array)

View File

@ -131,7 +131,4 @@ If you see a red mark, please correct your code accordingly.
- [ ] Your branch is up-to-date with the `master` branch and tested with latest changes - [ ] Your branch is up-to-date with the `master` branch and tested with latest changes
- [ ] Extended the README / documentation, if necessary - [ ] Extended the README / documentation, if necessary
- [ ] Code compiles correctly - [ ] Code compiles correctly
- [ ] All tests passing - [ ] All tests passing with `make check`
- [ ] `make check`
- [ ] `pylint --disable=R,C --rcfile=PythonClient/.pylintrc PythonClient/carla PythonClient/*.py`
- [ ] `cppcheck . -iBuild -i.pb.cc --enable=warning`

View File

@ -213,7 +213,7 @@ vector as we show in the following code excerpt:
The full code could be found at [basic_experiment_suite.py](https://github.com/carla-simulator/carla/blob/master/PythonClient/carla/driving_benchmark/experiment_suites/basic_experiment_suite.py) The full code could be found at [basic_experiment_suite.py](https://github.com/carla-simulator/carla/blob/master/Deprecated/PythonClient/carla/driving_benchmark/experiment_suites/basic_experiment_suite.py)

View File

@ -1,10 +1,11 @@
<h1>Cameras and sensors</h1> <h1>Cameras and sensors</h1>
!!! important !!! important
This document still refers to the 0.8.X API (stable version). The This document still refers to the 0.8.X API (stable version), this API is
proceedings stated here may not apply to latest versions, 0.9.0 or later. currently located under _"Deprecated/PythonClient"_. The proceedings stated
Latest versions introduced significant changes in the API, we are still here may not apply to latest versions, 0.9.0 or later. Latest versions
working on documenting everything, sorry for the inconvenience. introduced significant changes in the API, we are still working on
documenting everything, sorry for the inconvenience.
!!! important !!! important
Since version 0.8.0 the positions of the sensors are specified in meters Since version 0.8.0 the positions of the sensors are specified in meters
@ -30,7 +31,8 @@ moment there are four different sensors available.
The images are sent by the server as a BGRA array of bytes. The provided The images are sent by the server as a BGRA array of bytes. The provided
Python client retrieves the images in this format, it's up to the users to Python client retrieves the images in this format, it's up to the users to
parse the images and convert them to the desired format. There are some parse the images and convert them to the desired format. There are some
examples in the PythonClient folder showing how to parse the images. examples in the Deprecated/PythonClient folder showing how to parse the
images.
There is a fourth post-processing effect available for cameras, _None_, which There is a fourth post-processing effect available for cameras, _None_, which
provides a view with of the scene with no effect, not even scene lighting; we provides a view with of the scene with no effect, not even scene lighting; we
@ -46,7 +48,7 @@ number_ matches the one received in the measurements. This is especially useful
for running the simulator in asynchronous mode and synchronize sensor data on for running the simulator in asynchronous mode and synchronize sensor data on
the client side. the client side.
[clientexamplelink]: https://github.com/carla-simulator/carla/blob/master/PythonClient/client_example.py [clientexamplelink]: https://github.com/carla-simulator/carla/blob/master/Deprecated/PythonClient/client_example.py
[settingslink]: https://github.com/carla-simulator/carla/blob/master/Docs/Example.CarlaSettings.ini [settingslink]: https://github.com/carla-simulator/carla/blob/master/Docs/Example.CarlaSettings.ini
[imgconvlink]: https://github.com/carla-simulator/carla/tree/master/Util/ImageConverter [imgconvlink]: https://github.com/carla-simulator/carla/tree/master/Util/ImageConverter
@ -128,7 +130,7 @@ Our max render distance (far) is 1km.
The generated "depth map" images are usually converted to a logarithmic The generated "depth map" images are usually converted to a logarithmic
grayscale for display. A point cloud can also be extracted from depth images as grayscale for display. A point cloud can also be extracted from depth images as
seen in "PythonClient/point_cloud_example.py". seen in "Deprecated/PythonClient/point_cloud_example.py".
<h6>Python</h6> <h6>Python</h6>

View File

@ -6,7 +6,7 @@ CARLA Design
CARLA is composed by the following modules CARLA is composed by the following modules
* Client side * Client side
- Python client API: "PythonClient/carla" - Python client API: "Deprecated/PythonClient/carla"
* Server side * Server side
- CarlaUE4 Unreal Engine project: "Unreal/CarlaUE4" - CarlaUE4 Unreal Engine project: "Unreal/CarlaUE4"
- Carla plugin for Unreal Engine: "Unreal/CarlaUE4/Plugins/Carla" - Carla plugin for Unreal Engine: "Unreal/CarlaUE4/Plugins/Carla"
@ -20,7 +20,7 @@ Python client API
----------------- -----------------
The client API provides a Python module for communicating with the CARLA server. The client API provides a Python module for communicating with the CARLA server.
In the folder "PythonClient", we provide several examples for scripting a CARLA In the folder "Deprecated/PythonClient", we provide several examples for scripting a CARLA
client using the "carla" module. client using the "carla" module.
CarlaUE4 Unreal Engine project CarlaUE4 Unreal Engine project

View File

@ -8,11 +8,11 @@ aspects of simulation, from environment to duration of each episode, it can
retrieve data from different sensors, and send control instructions to the retrieve data from different sensors, and send control instructions to the
player vehicle. player vehicle.
PythonClient contents Deprecated/PythonClient contents
--------------------- --------------------------------
In the release package, inside the _"PythonClient"_ folder, we provide the In the release package, inside the _"Deprecated/PythonClient"_ folder, we
Python API module together with some use examples. provide the Python API module together with some use examples.
File or folder | Description File or folder | Description
------------------------ | ------------ ------------------------ | ------------
@ -25,9 +25,9 @@ view_start_positions.py | Show all the possible start positions in a map
!!! note !!! note
If you are building CARLA from source, the Python code is inside the If you are building CARLA from source, the Python code is inside the
_"PythonClient"_ folder in the CARLA repository. Bear in mind that the _"Deprecated/PythonClient"_ folder in the CARLA repository. Bear in mind
`master` branch contains latest fixes and changes that might be incompatible that the `master` branch contains latest fixes and changes that might be
with the release version. Consider using the `stable` branch. incompatible with the release version. Consider using the `stable` branch.
Install dependencies Install dependencies
-------------------- --------------------
@ -37,7 +37,7 @@ given examples is also compatible with Python 2.7.
Install the dependencies with "pip" using the requirements file provided Install the dependencies with "pip" using the requirements file provided
$ pip install -r PythonClient/requirements.txt $ pip install -r Deprecated/PythonClient/requirements.txt
Running the client example Running the client example
-------------------------- --------------------------
@ -96,7 +96,6 @@ You can see all the available options in the script's help
<h4>Running other examples</h4> <h4>Running other examples</h4>
The other scripts present in the _"PythonClient"_ folder run in a similar The other scripts present in the _"Deprecated/PythonClient"_ folder run in a
fashion. We recommend now launching _"manual_control.py"_ for a GUI interface similar fashion. We recommend now launching _"manual_control.py"_ for a GUI
implemented with PyGame. interface implemented with PyGame.

View File

@ -8,10 +8,7 @@ Checklist:
- [ ] Your branch is up-to-date with the `master` branch and tested with latest changes - [ ] Your branch is up-to-date with the `master` branch and tested with latest changes
- [ ] Extended the README / documentation, if necessary - [ ] Extended the README / documentation, if necessary
- [ ] Code compiles correctly - [ ] Code compiles correctly
- [ ] All tests passing - [ ] All tests passing with `make check`
- [ ] `make check`
- [ ] `pylint --disable=R,C --rcfile=PythonClient/.pylintrc PythonClient/carla PythonClient/*.py`
- [ ] `cppcheck . -iBuild -i.pb.cc --enable=warning`
--> -->

View File

@ -37,6 +37,19 @@ namespace client {
}); });
} }
const ActorAttribute &ActorBlueprint::GetAttribute(const std::string &id) const {
auto it = _attributes.find(id);
if (it == _attributes.end()) {
using namespace std::string_literals;
throw std::out_of_range("attribute '"s + id + "' not found");
}
return it->second;
}
void ActorBlueprint::SetAttribute(const std::string &id, std::string value) {
const_cast<ActorAttribute &>(GetAttribute(id)).Set(std::move(value));
}
rpc::ActorDescription ActorBlueprint::MakeActorDescription() const { rpc::ActorDescription ActorBlueprint::MakeActorDescription() const {
rpc::ActorDescription description; rpc::ActorDescription description;
description.uid = _uid; description.uid = _uid;

View File

@ -76,18 +76,14 @@ namespace client {
} }
/// @throw std::out_of_range if no such element exists. /// @throw std::out_of_range if no such element exists.
const ActorAttribute &GetAttribute(const std::string &id) const { const ActorAttribute &GetAttribute(const std::string &id) const;
return _attributes.at(id);
}
/// Set the value of the attribute given by @a id. /// Set the value of the attribute given by @a id.
/// ///
/// @throw std::out_of_range if no such element exists. /// @throw std::out_of_range if no such element exists.
/// @throw InvalidAttributeValue if attribute is not modifiable. /// @throw InvalidAttributeValue if attribute is not modifiable.
/// @throw InvalidAttributeValue if format does not match the attribute type. /// @throw InvalidAttributeValue if format does not match the attribute type.
void SetAttribute(const std::string &id, std::string value) { void SetAttribute(const std::string &id, std::string value);
_attributes.at(id).Set(std::move(value));
}
size_t size() const { size_t size() const {
return _attributes.size(); return _attributes.size();

View File

@ -31,6 +31,20 @@ namespace client {
return SharedPtr<BlueprintLibrary>{new BlueprintLibrary(result)}; return SharedPtr<BlueprintLibrary>{new BlueprintLibrary(result)};
} }
BlueprintLibrary::const_pointer BlueprintLibrary::Find(const std::string &key) const {
auto it = _blueprints.find(key);
return it != _blueprints.end() ? &it->second : nullptr;
}
BlueprintLibrary::const_reference BlueprintLibrary::at(const std::string &key) const {
auto it = _blueprints.find(key);
if (it == _blueprints.end()) {
using namespace std::string_literals;
throw std::out_of_range("blueprint '"s + key + "' not found");
}
return it->second;
}
BlueprintLibrary::const_reference BlueprintLibrary::at(size_type pos) const { BlueprintLibrary::const_reference BlueprintLibrary::at(size_type pos) const {
if (pos >= size()) if (pos >= size())
throw std::out_of_range("index out of range"); throw std::out_of_range("index out of range");

View File

@ -44,14 +44,10 @@ namespace client {
/// @a wildcard_pattern. /// @a wildcard_pattern.
SharedPtr<BlueprintLibrary> Filter(const std::string &wildcard_pattern) const; SharedPtr<BlueprintLibrary> Filter(const std::string &wildcard_pattern) const;
const_pointer Find(const std::string &key) const { const_pointer Find(const std::string &key) const;
auto it = _blueprints.find(key);
return it != _blueprints.end() ? &it->second : nullptr;
}
const_reference at(const std::string &key) const { /// @throw std::out_of_range if no such element exists.
return _blueprints.at(key); const_reference at(const std::string &key) const;
}
/// @warning Linear complexity. /// @warning Linear complexity.
const_reference operator[](size_type pos) const { const_reference operator[](size_type pos) const {
@ -59,6 +55,7 @@ namespace client {
} }
/// @warning Linear complexity. /// @warning Linear complexity.
/// @throw std::out_of_range if !(pos < size()).
const_reference at(size_type pos) const; const_reference at(size_type pos) const;
const_iterator begin() const /*noexcept*/ { const_iterator begin() const /*noexcept*/ {

View File

@ -11,6 +11,8 @@
#include <exception> #include <exception>
#include <exception>
namespace carla { namespace carla {
namespace client { namespace client {

View File

@ -14,6 +14,10 @@
MSGPACK_ADD_ENUM(carla::rpc::ActorAttributeType); MSGPACK_ADD_ENUM(carla::rpc::ActorAttributeType);
#ifdef LIBCARLA_INCLUDED_FROM_UE4
# include "Carla/Actor/ActorAttribute.h"
#endif // LIBCARLA_INCLUDED_FROM_UE4
namespace carla { namespace carla {
namespace rpc { namespace rpc {

View File

@ -13,6 +13,10 @@
#include <vector> #include <vector>
#ifdef LIBCARLA_INCLUDED_FROM_UE4
# include "Carla/Actor/ActorDescription.h"
#endif // LIBCARLA_INCLUDED_FROM_UE4
namespace carla { namespace carla {
namespace rpc { namespace rpc {

View File

@ -21,6 +21,6 @@
#include <cstdint> #include <cstdint>
#include <iostream> #include <iostream>
constexpr uint16_t TESTING_PORT = 2000u; constexpr uint16_t TESTING_PORT = 2017u;
using namespace std::chrono_literals; using namespace std::chrono_literals;

View File

@ -20,7 +20,7 @@ def get_libcarla_extensions():
sources = ['source/libcarla/libcarla.cpp'] sources = ['source/libcarla/libcarla.cpp']
if os.name == "posix": if os.name == "posix":
if platform.dist()[0] == "Ubuntu": if platform.dist()[0].lower() in ["ubuntu", "debian"]:
pwd = os.path.dirname(os.path.realpath(__file__)) pwd = os.path.dirname(os.path.realpath(__file__))
pylib = "libboost_python%d%d.a" % (sys.version_info.major, pylib = "libboost_python%d%d.a" % (sys.version_info.major,
sys.version_info.minor) sys.version_info.minor)

View File

@ -44,6 +44,7 @@ If you use CARLA, please cite our CoRL17 paper.
_CARLA: An Open Urban Driving Simulator_<br>Alexey Dosovitskiy, German Ros, _CARLA: An Open Urban Driving Simulator_<br>Alexey Dosovitskiy, German Ros,
Felipe Codevilla, Antonio Lopez, Vladlen Koltun; PMLR 78:1-16 Felipe Codevilla, Antonio Lopez, Vladlen Koltun; PMLR 78:1-16
[[PDF](http://proceedings.mlr.press/v78/dosovitskiy17a/dosovitskiy17a.pdf)] [[PDF](http://proceedings.mlr.press/v78/dosovitskiy17a/dosovitskiy17a.pdf)]
[[talk](https://www.youtube.com/watch?v=xfyK03MEZ9Q&feature=youtu.be&t=2h44m30s)]
``` ```

View File

@ -28,6 +28,7 @@ r.DefaultFeature.AmbientOcclusionStaticFraction=False
r.DefaultFeature.AutoExposure=False r.DefaultFeature.AutoExposure=False
r.CustomDepth=3 r.CustomDepth=3
r.Streaming.PoolSize=2000 r.Streaming.PoolSize=2000
r.TextureStreaming=False
[/Script/AIModule.AISense_Sight] [/Script/AIModule.AISense_Sight]
bAutoRegisterAllPawnsAsSources=False bAutoRegisterAllPawnsAsSources=False

View File

@ -128,6 +128,12 @@ public:
State = InState; State = InState;
} }
UFUNCTION(Category = "AI Controller", BlueprintCallable)
ECarlaWheeledVehicleState GetAIVehicleState() const
{
return State;
}
private: private:
/// Current state of the vehicle controller (for debugging purposes). /// Current state of the vehicle controller (for debugging purposes).

View File

@ -13,18 +13,18 @@ struct CARLA_API FVehicleControl
{ {
GENERATED_BODY() GENERATED_BODY()
UPROPERTY(Category = "Vehicle Control", EditAnywhere) UPROPERTY(Category = "Vehicle Control", EditAnywhere, BlueprintReadWrite)
float Throttle = 0.0f; float Throttle = 0.0f;
UPROPERTY(Category = "Vehicle Control", EditAnywhere) UPROPERTY(Category = "Vehicle Control", EditAnywhere, BlueprintReadWrite)
float Steer = 0.0f; float Steer = 0.0f;
UPROPERTY(Category = "Vehicle Control", EditAnywhere) UPROPERTY(Category = "Vehicle Control", EditAnywhere, BlueprintReadWrite)
float Brake = 0.0f; float Brake = 0.0f;
UPROPERTY(Category = "Vehicle Control", EditAnywhere) UPROPERTY(Category = "Vehicle Control", EditAnywhere, BlueprintReadWrite)
bool bHandBrake = false; bool bHandBrake = false;
UPROPERTY(Category = "Vehicle Control", EditAnywhere) UPROPERTY(Category = "Vehicle Control", EditAnywhere, BlueprintReadWrite)
bool bReverse = false; bool bReverse = false;
}; };

View File

@ -236,7 +236,7 @@ float AWheeledVehicleAIController::GoToNextTargetLocation(FVector &Direction)
return FVector{Result.X, Result.Y, CurrentLocation.Z}; return FVector{Result.X, Result.Y, CurrentLocation.Z};
}(); }();
if (Target.Equals(CurrentLocation, 80.0f)) { if (Target.Equals(CurrentLocation, 200.0f)) {
TargetLocations.pop(); TargetLocations.pop();
if (!TargetLocations.empty()) { if (!TargetLocations.empty()) {
return GoToNextTargetLocation(Direction); return GoToNextTargetLocation(Direction);

View File

@ -185,8 +185,8 @@ public:
/// @name AI /// @name AI
// =========================================================================== // ===========================================================================
/// @{ /// @{
protected:
UFUNCTION(Category = "Wheeled Vehicle Controller", BlueprintCallable)
const FVehicleControl &GetAutopilotControl() const const FVehicleControl &GetAutopilotControl() const
{ {
return AutopilotControl; return AutopilotControl;

View File

@ -2,7 +2,7 @@
set PROTOBUF_SRC_DIR=Proto set PROTOBUF_SRC_DIR=Proto
set PROTOBUF_CPP_OUT_DIR=CarlaServer/source/carla/server set PROTOBUF_CPP_OUT_DIR=CarlaServer/source/carla/server
set PROTOBUF_PY_OUT_DIR=../PythonClient/carla set PROTOBUF_PY_OUT_DIR=../Deprecated/PythonClient/carla
set PROTO_BASENAME=carla_server set PROTO_BASENAME=carla_server
if "%1" == "--clean" ( if "%1" == "--clean" (

View File

@ -7,7 +7,7 @@ pushd "$SCRIPT_DIR" >/dev/null
PROTOBUF_SRC_DIR=Proto PROTOBUF_SRC_DIR=Proto
PROTOBUF_CPP_OUT_DIR=CarlaServer/source/carla/server PROTOBUF_CPP_OUT_DIR=CarlaServer/source/carla/server
PROTOBUF_PY_OUT_DIR=../PythonClient/carla PROTOBUF_PY_OUT_DIR=../Deprecated/PythonClient/carla
PROTO_BASENAME=carla_server PROTO_BASENAME=carla_server
if [ "$1" == "--clean" ]; then if [ "$1" == "--clean" ]; then

View File

@ -41,7 +41,7 @@ http://wiki.ros.org/ROS/Tutorials/InstallingandConfiguringROSEnvironment
## Install carla python client in your workspace ## Install carla python client in your workspace
cd carla/PythonClient cd carla/Deprecated/PythonClient
pip2 install -e . --user --upgrade pip2 install -e . --user --upgrade
Check the installation is successfull by trying to import carla from python: Check the installation is successfull by trying to import carla from python:
@ -73,7 +73,7 @@ Run the following command after replacing [PATH_TO_CARLA] with the actual path t
If you use the builded binary (0.8.2): If you use the builded binary (0.8.2):
./CarlaUE4 -carla-server -windowed -ResX=320 -ResY=240 ./CarlaUE4.sh -carla-server -windowed -ResX=320 -ResY=240
Wait for the message: Wait for the message: