Merge branch 'master' into roads

This commit is contained in:
nsubiron 2018-10-28 11:35:42 +01:00
commit 92f8fe7fd6
111 changed files with 735 additions and 116 deletions

2
.gitignore vendored
View File

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

View File

@ -45,10 +45,10 @@ matrix:
- python
- python-pip
install:
- pip2 install -q --user -r PythonClient/requirements.txt
- pip2 install -q --user -r Deprecated/PythonClient/requirements.txt
- pip2 install -q --user pylint
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"
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.
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):
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
- [ ] Extended the README / documentation, if necessary
- [ ] Code compiles correctly
- [ ] All tests passing
- [ ] `make check`
- [ ] `pylint --disable=R,C --rcfile=PythonClient/.pylintrc PythonClient/carla PythonClient/*.py`
- [ ] `cppcheck . -iBuild -i.pb.cc --enable=warning`
- [ ] All tests passing with `make check`

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>
!!! important
This document still refers to the 0.8.X API (stable version). The
proceedings stated here may not apply to latest versions, 0.9.0 or later.
Latest versions introduced significant changes in the API, we are still
working on documenting everything, sorry for the inconvenience.
This document still refers to the 0.8.X API (stable version), this API is
currently located under _"Deprecated/PythonClient"_. The proceedings stated
here may not apply to latest versions, 0.9.0 or later. Latest versions
introduced significant changes in the API, we are still working on
documenting everything, sorry for the inconvenience.
!!! important
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
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
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
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
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
[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
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>

View File

@ -6,7 +6,7 @@ CARLA Design
CARLA is composed by the following modules
* Client side
- Python client API: "PythonClient/carla"
- Python client API: "Deprecated/PythonClient/carla"
* Server side
- CarlaUE4 Unreal Engine project: "Unreal/CarlaUE4"
- 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.
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.
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
player vehicle.
PythonClient contents
---------------------
Deprecated/PythonClient contents
--------------------------------
In the release package, inside the _"PythonClient"_ folder, we provide the
Python API module together with some use examples.
In the release package, inside the _"Deprecated/PythonClient"_ folder, we
provide the Python API module together with some use examples.
File or folder | Description
------------------------ | ------------
@ -25,9 +25,9 @@ view_start_positions.py | Show all the possible start positions in a map
!!! note
If you are building CARLA from source, the Python code is inside the
_"PythonClient"_ folder in the CARLA repository. Bear in mind that the
`master` branch contains latest fixes and changes that might be incompatible
with the release version. Consider using the `stable` branch.
_"Deprecated/PythonClient"_ folder in the CARLA repository. Bear in mind
that the `master` branch contains latest fixes and changes that might be
incompatible with the release version. Consider using the `stable` branch.
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
$ pip install -r PythonClient/requirements.txt
$ pip install -r Deprecated/PythonClient/requirements.txt
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>
The other scripts present in the _"PythonClient"_ folder run in a similar
fashion. We recommend now launching _"manual_control.py"_ for a GUI interface
implemented with PyGame.
The other scripts present in the _"Deprecated/PythonClient"_ folder run in a
similar fashion. We recommend now launching _"manual_control.py"_ for a GUI
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
- [ ] Extended the README / documentation, if necessary
- [ ] Code compiles correctly
- [ ] All tests passing
- [ ] `make check`
- [ ] `pylint --disable=R,C --rcfile=PythonClient/.pylintrc PythonClient/carla PythonClient/*.py`
- [ ] `cppcheck . -iBuild -i.pb.cc --enable=warning`
- [ ] All tests passing with `make check`
-->

View File

@ -17,6 +17,7 @@
- `id`
- `map_name`
- `debug`
- `get_blueprint_library()`
- `get_map()`
- `get_spectator()`
@ -28,6 +29,14 @@
- `wait_for_tick(seconds=1.0)`
- `on_tick(callback)`
## `carla.DebugHelper`
- `draw_point(location, size=0.1, color={Red}, life_time=-1.0, persistent_lines=True)`
- `draw_line(begin, end, thickness=0.1, color={Red}, life_time=-1.0, persistent_lines=True)`
- `draw_arrow(begin, end, thickness=0.1, arrow_size=0.1, color={Red}, life_time=-1.0, persistent_lines=True)`
- `draw_box(box, rotation, thickness=0.1, color={Red}, life_time=-1.0, persistent_lines=True)`
- `draw_string(location, text, draw_shadow=False, color={Red}, life_time=-1.0, persistent_lines=True)`
## `carla.BlueprintLibrary`
- `find(id)`

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 description;
description.uid = _uid;

View File

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

View File

@ -31,6 +31,20 @@ namespace client {
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 {
if (pos >= size())
throw std::out_of_range("index out of range");

View File

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

View File

@ -0,0 +1,85 @@
// 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/client/DebugHelper.h"
#include "carla/client/detail/Simulator.h"
#include "carla/rpc/DebugShape.h"
namespace carla {
namespace client {
using Shape = rpc::DebugShape;
template <typename T>
static void DrawShape(
detail::EpisodeProxy &episode,
const T &primitive,
rpc::Color color,
float life_time,
bool persistent_lines) {
const Shape shape{primitive, color, life_time, persistent_lines};
episode.Lock()->DrawDebugShape(shape);
}
void DebugHelper::DrawPoint(
const geom::Location &location,
float size,
sensor::data::Color color,
float life_time,
bool persistent_lines) {
Shape::Point point{location, size};
DrawShape(_episode, point, color, life_time, persistent_lines);
}
void DebugHelper::DrawLine(
const geom::Location &begin,
const geom::Location &end,
float thickness,
sensor::data::Color color,
float life_time,
bool persistent_lines) {
Shape::Line line{begin, end, thickness};
DrawShape(_episode, line, color, life_time, persistent_lines);
}
void DebugHelper::DrawArrow(
const geom::Location &begin,
const geom::Location &end,
float thickness,
float arrow_size,
sensor::data::Color color,
float life_time,
bool persistent_lines) {
Shape::Line line{begin, end, thickness};
Shape::Arrow arrow{line, arrow_size};
DrawShape(_episode, arrow, color, life_time, persistent_lines);
}
void DebugHelper::DrawBox(
const geom::BoundingBox &box,
const geom::Rotation &rotation,
float thickness,
sensor::data::Color color,
float life_time,
bool persistent_lines) {
Shape::Box the_box{box, rotation, thickness};
DrawShape(_episode, the_box, color, life_time, persistent_lines);
}
void DebugHelper::DrawString(
const geom::Location &location,
const std::string &text,
bool draw_shadow,
sensor::data::Color color,
float life_time,
bool persistent_lines) {
Shape::String string{location, text, draw_shadow};
DrawShape(_episode, string, color, life_time, persistent_lines);
}
} // namespace client
} // namespace carla

View File

@ -0,0 +1,72 @@
// 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/client/detail/EpisodeProxy.h"
#include "carla/geom/BoundingBox.h"
#include "carla/geom/Location.h"
#include "carla/geom/Rotation.h"
#include "carla/sensor/data/Color.h"
namespace carla {
namespace client {
class DebugHelper {
public:
using Color = sensor::data::Color;
explicit DebugHelper(detail::EpisodeProxy episode)
: _episode(std::move(episode)) {}
void DrawPoint(
const geom::Location &location,
float size = 0.1f,
Color color = Color{255u, 0u, 0u},
float life_time = -1.0f,
bool persistent_lines = true);
void DrawLine(
const geom::Location &begin,
const geom::Location &end,
float thickness = 0.1f,
Color color = Color{255u, 0u, 0u},
float life_time = -1.0f,
bool persistent_lines = true);
void DrawArrow(
const geom::Location &begin,
const geom::Location &end,
float thickness = 0.1f,
float arrow_size = 0.1f,
Color color = Color{255u, 0u, 0u},
float life_time = -1.0f,
bool persistent_lines = true);
void DrawBox(
const geom::BoundingBox &box,
const geom::Rotation &rotation,
float thickness = 0.1f,
Color color = Color{255u, 0u, 0u},
float life_time = -1.0f,
bool persistent_lines = true);
void DrawString(
const geom::Location &location,
const std::string &text,
bool draw_shadow = false,
Color color = Color{255u, 0u, 0u},
float life_time = -1.0f,
bool persistent_lines = true);
private:
detail::EpisodeProxy _episode;
};
} // namespace client
} // namespace carla

View File

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

View File

@ -8,6 +8,7 @@
#include "carla/Memory.h"
#include "carla/Time.h"
#include "carla/client/DebugHelper.h"
#include "carla/client/Timestamp.h"
#include "carla/client/detail/EpisodeProxy.h"
#include "carla/geom/Transform.h"
@ -80,6 +81,10 @@ namespace client {
/// Register a @a callback to be called every time a world tick is received.
void OnTick(std::function<void(Timestamp)> callback);
DebugHelper MakeDebugHelper() const {
return DebugHelper{_episode};
}
private:
detail::EpisodeProxy _episode;

View File

@ -9,6 +9,7 @@
#include "carla/Version.h"
#include "carla/rpc/ActorDescription.h"
#include "carla/rpc/Client.h"
#include "carla/rpc/DebugShape.h"
#include "carla/rpc/VehicleControl.h"
#include "carla/streaming/Client.h"
@ -152,6 +153,10 @@ namespace detail {
_pimpl->streaming_client.UnSubscribe(token);
}
void Client::DrawDebugShape(const rpc::DebugShape &shape) {
_pimpl->AsyncCall("draw_debug_shape", shape);
}
} // namespace detail
} // namespace client
} // namespace carla

View File

@ -26,6 +26,7 @@ namespace carla {
class Buffer;
namespace rpc {
class ActorDescription;
class DebugShape;
class VehicleControl;
}
namespace sensor { class SensorData; }
@ -107,6 +108,8 @@ namespace detail {
void UnSubscribeFromStream(const streaming::Token &token);
void DrawDebugShape(const rpc::DebugShape &shape);
private:
class Pimpl;

View File

@ -215,6 +215,16 @@ namespace detail {
void UnSubscribeFromSensor(const Sensor &sensor);
/// @}
// =========================================================================
/// @name Debug
// =========================================================================
/// @{
void DrawDebugShape(const rpc::DebugShape &shape) {
_client.DrawDebugShape(shape);
}
/// @}
private:

View File

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

View File

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

View File

@ -0,0 +1,50 @@
// 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/MsgPack.h"
#include <cstdint>
#ifdef LIBCARLA_INCLUDED_FROM_UE4
# include "Math/Color.h"
#endif // LIBCARLA_INCLUDED_FROM_UE4
namespace carla {
namespace rpc {
class Color {
public:
uint8_t r = 0u;
uint8_t g = 0u;
uint8_t b = 0u;
Color() = default;
Color(const Color &) = default;
Color(uint8_t r, uint8_t g, uint8_t b)
: r(r), g(g), b(b) {}
Color &operator=(const Color &) = default;
#ifdef LIBCARLA_INCLUDED_FROM_UE4
Color(const FColor &color)
: Color(color.R, color.G, color.B) {}
operator FColor() const {
return FColor{r, g, b};
}
#endif // LIBCARLA_INCLUDED_FROM_UE4
MSGPACK_DEFINE_ARRAY(r, g, b);
};
} // namespace rpc
} // namespace carla

View File

@ -0,0 +1,70 @@
// 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/geom/BoundingBox.h"
#include "carla/geom/Location.h"
#include "carla/geom/Rotation.h"
#include "carla/rpc/Color.h"
#include "carla/rpc/Variant.h"
// #include <rpc/msgpack/adaptor/boost/msgpack_variant.hpp>
// #include <boost/variant.hpp>
namespace carla {
namespace rpc {
class DebugShape {
public:
struct Point {
geom::Location location;
float size;
MSGPACK_DEFINE_ARRAY(location, size);
};
struct Line {
geom::Location begin;
geom::Location end;
float thickness;
MSGPACK_DEFINE_ARRAY(begin, end, thickness);
};
struct Arrow {
Line line;
float arrow_size;
MSGPACK_DEFINE_ARRAY(line, arrow_size);
};
struct Box {
geom::BoundingBox box;
geom::Rotation rotation;
float thickness;
MSGPACK_DEFINE_ARRAY(box, rotation, thickness);
};
struct String {
geom::Location location;
std::string text;
bool draw_shadow;
MSGPACK_DEFINE_ARRAY(location, text, draw_shadow);
};
Variant<Point, Line, Arrow, Box, String> primitive;
Color color = {255u, 0u, 0u};
float life_time = -1.0f;
bool persistent_lines = true;
MSGPACK_DEFINE_ARRAY(primitive, color, life_time, persistent_lines);
};
} // namespace rpc
} // namespace carla

View File

@ -0,0 +1,70 @@
// 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/MsgPack.h"
#include <tuple>
namespace carla {
namespace rpc {
/// @todo Workaround for packing boost::variant; it uses tuple instead so it's
/// quite inefficient memory-wise.
template <typename... Ts>
class Variant {
private:
size_t _index = 0u;
std::tuple<Ts...> _tuple;
template <typename T, typename Tuple>
struct IndexFromType;
template <typename T, typename... Types>
struct IndexFromType<T, std::tuple<T, Types...>> {
static constexpr size_t value = 0u;
};
template <typename T, typename U, typename... Types>
struct IndexFromType<T, std::tuple<U, Types...>> {
static constexpr size_t value = 1u + IndexFromType<T, std::tuple<Types...>>::value;
};
template <typename VisitorT, size_t... Is>
void ApplyVisitorImpl(VisitorT &visitor, std::index_sequence<Is...>) const {
std::initializer_list<int> ({ (_index == Is ? visitor(std::get<Is>(_tuple)), 0 : 0)... });
}
public:
Variant() = default;
template <typename ObjT>
Variant(ObjT &&rhs) {
(*this) = std::forward<ObjT>(rhs);
}
template <typename ObjT>
Variant &operator=(ObjT &&rhs) {
constexpr auto index = IndexFromType<typename std::decay<ObjT>::type, decltype(_tuple)>::value;
_index = index;
std::get<index>(_tuple) = std::forward<ObjT>(rhs);
return *this;
}
template <typename VisitorT>
void ApplyVisitor(VisitorT visitor) const {
return ApplyVisitorImpl(visitor, std::make_index_sequence<sizeof...(Ts)>());
}
MSGPACK_DEFINE_ARRAY(_index, _tuple);
};
} // namespace rpc
} // namespace carla

View File

@ -6,6 +6,8 @@
#pragma once
#include "carla/rpc/Color.h"
#include <cstdint>
namespace carla {
@ -31,6 +33,10 @@ namespace data {
return !(*this == rhs);
}
operator rpc::Color() const {
return {r, g, b};
}
uint8_t b = 0u;
uint8_t g = 0u;
uint8_t r = 0u;

View File

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

View File

@ -1,5 +1,18 @@
#!/usr/bin/env python
# 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>.
"""
CARLA Dynamic Weather:
Connect to a CARLA Simulator instance and control the weather. Change Sun
position smoothly with time and generate storms occasionally.
"""
import glob
import os
import sys
@ -87,12 +100,7 @@ class Weather(object):
def main():
argparser = argparse.ArgumentParser(
description='CARLA Dynamic Weather')
argparser.add_argument(
'-v', '--verbose',
action='store_true',
dest='debug',
help='print debug information')
description=__doc__)
argparser.add_argument(
'--host',
metavar='H',
@ -109,7 +117,7 @@ def main():
metavar='FACTOR',
default=1.0,
type=float,
help='update speed (default: 1.0)')
help='rate at which the weather changes (default: 1.0)')
args = argparser.parse_args()
speed_factor = args.speed

View File

@ -6,8 +6,8 @@
# This work is licensed under the terms of the MIT license.
# For a copy, see <https://opensource.org/licenses/MIT>.
# Keyboard controlling for CARLA. Please refer to client_example.py for a simpler
# and more documented example.
# Allows controlling a vehicle with a keyboard. For a simpler and more
# documented example, please take a look at tutorial.py.
"""
Welcome to CARLA manual control.

View File

@ -20,7 +20,7 @@ def get_libcarla_extensions():
sources = ['source/libcarla/libcarla.cpp']
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__))
pylib = "libboost_python%d%d.a" % (sys.version_info.major,
sys.version_info.minor)

View File

@ -84,6 +84,7 @@ void export_world() {
class_<cc::World>("World", no_init)
.add_property("id", &cc::World::GetId)
.add_property("map_name", CALL_RETURNING_COPY(cc::World, GetMapName))
.add_property("debug", &cc::World::MakeDebugHelper)
.def("get_blueprint_library", CONST_CALL_WITHOUT_GIL(cc::World, GetBlueprintLibrary))
.def("get_map", CONST_CALL_WITHOUT_GIL(cc::World, GetMap))
.def("get_spectator", CONST_CALL_WITHOUT_GIL(cc::World, GetSpectator))
@ -98,4 +99,42 @@ void export_world() {
;
#undef SPAWN_ACTOR_WITHOUT_GIL
class_<cc::DebugHelper>("DebugHelper", no_init)
.def("draw_point", &cc::DebugHelper::DrawPoint,
(arg("location"),
arg("size")=0.1f,
arg("color")=cc::DebugHelper::Color(255u, 0u, 0u),
arg("life_time")=-1.0f,
arg("persistent_lines")=true))
.def("draw_line", &cc::DebugHelper::DrawLine,
(arg("begin"),
arg("end"),
arg("thickness")=0.1f,
arg("color")=cc::DebugHelper::Color(255u, 0u, 0u),
arg("life_time")=-1.0f,
arg("persistent_lines")=true))
.def("draw_arrow", &cc::DebugHelper::DrawArrow,
(arg("begin"),
arg("end"),
arg("thickness")=0.1f,
arg("arrow_size")=0.1f,
arg("color")=cc::DebugHelper::Color(255u, 0u, 0u),
arg("life_time")=-1.0f,
arg("persistent_lines")=true))
.def("draw_box", &cc::DebugHelper::DrawBox,
(arg("box"),
arg("rotation"),
arg("thickness")=0.1f,
arg("color")=cc::DebugHelper::Color(255u, 0u, 0u),
arg("life_time")=-1.0f,
arg("persistent_lines")=true))
.def("draw_string", &cc::DebugHelper::DrawString,
(arg("location"),
arg("text"),
arg("draw_shadow")=false,
arg("color")=cc::DebugHelper::Color(255u, 0u, 0u),
arg("life_time")=-1.0f,
arg("persistent_lines")=true))
;
}

View File

@ -1,5 +1,11 @@
#!/usr/bin/env python
# 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>.
import glob
import os
import sys

View File

@ -1,5 +1,11 @@
#!/usr/bin/env python
# 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>.
import glob
import os
import sys

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,
Felipe Codevilla, Antonio Lopez, Vladlen Koltun; PMLR 78:1-16
[[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.CustomDepth=3
r.Streaming.PoolSize=2000
r.TextureStreaming=False
[/Script/AIModule.AISense_Sight]
bAutoRegisterAllPawnsAsSources=False

View File

@ -8,6 +8,7 @@
#include "Carla/Server/TheNewCarlaServer.h"
#include "Carla/Sensor/Sensor.h"
#include "Carla/Util/DebugShapeDrawer.h"
#include "Carla/Util/OpenDrive.h"
#include "Carla/Vehicle/CarlaWheeledVehicle.h"
@ -18,6 +19,7 @@
#include <carla/rpc/Actor.h>
#include <carla/rpc/ActorDefinition.h>
#include <carla/rpc/ActorDescription.h>
#include <carla/rpc/DebugShape.h>
#include <carla/rpc/EpisodeInfo.h>
#include <carla/rpc/MapInfo.h>
#include <carla/rpc/Server.h>
@ -382,6 +384,14 @@ void FTheNewCarlaServer::FPimpl::BindActions()
}
Controller->SetAutopilot(bEnabled);
});
Server.BindSync("draw_debug_shape", [this](const cr::DebugShape &shape) {
RequireEpisode();
auto *World = Episode->GetWorld();
check(World != nullptr);
FDebugShapeDrawer Drawer(*World);
Drawer.Draw(shape);
});
}
// =============================================================================

View File

@ -127,8 +127,8 @@ static bool GetSettingsFilePathFromCommandLine(FString &Value)
if (FPaths::IsRelative(Value))
{
Value = FPaths::ConvertRelativePathToFull(FPaths::LaunchDir(), Value);
return true;
}
return true;
}
return false;
}

View File

@ -0,0 +1,110 @@
// 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.h"
#include "Carla/Util/DebugShapeDrawer.h"
#include "DrawDebugHelpers.h"
#include <compiler/disable-ue4-macros.h>
#include <carla/rpc/DebugShape.h>
#include <carla/rpc/String.h>
#include <compiler/enable-ue4-macros.h>
struct FShapeVisitor
{
using Shape = carla::rpc::DebugShape;
FShapeVisitor(UWorld &InWorld, FColor InColor, float InLifeTime, bool bInPersistentLines)
: World(&InWorld),
Color(InColor),
LifeTime(InLifeTime),
bPersistentLines(bInPersistentLines) {}
void operator()(const Shape::Point &Point) const
{
DrawDebugPoint(
World,
Point.location,
1e2f * Point.size,
Color,
bPersistentLines,
LifeTime,
DepthPriority);
}
void operator()(const Shape::Line &Line) const
{
DrawDebugLine(
World,
Line.begin,
Line.end,
Color,
bPersistentLines,
LifeTime,
DepthPriority,
1e2f * Line.thickness);
}
void operator()(const Shape::Arrow &Arrow) const
{
DrawDebugDirectionalArrow(
World,
Arrow.line.begin,
Arrow.line.end,
1e2f * Arrow.arrow_size,
Color,
bPersistentLines,
LifeTime,
DepthPriority,
1e2f * Arrow.line.thickness);
}
void operator()(const Shape::Box &Box) const
{
FVector Extent = {Box.box.extent.x, Box.box.extent.y, Box.box.extent.z};
DrawDebugBox(
World,
Box.box.location,
1e2f * Extent,
FQuat(FRotator(Box.rotation)),
Color,
bPersistentLines,
LifeTime,
DepthPriority,
1e2f * Box.thickness);
}
void operator()(const Shape::String &Str) const
{
DrawDebugString(
World,
Str.location,
carla::rpc::ToFString(Str.text),
nullptr,
Color,
LifeTime,
Str.draw_shadow);
}
private:
UWorld *World;
FColor Color;
float LifeTime;
bool bPersistentLines;
uint8 DepthPriority = 0;
};
void FDebugShapeDrawer::Draw(const carla::rpc::DebugShape &Shape)
{
auto Visitor = FShapeVisitor(World, Shape.color, Shape.life_time, Shape.persistent_lines);
Shape.primitive.ApplyVisitor(Visitor);
}

Some files were not shown because too many files have changed in this diff Show More