Move from boost optional, variant, shared_ptr, filesystem to STL. Update copyright notices.
This commit is contained in:
parent
06a2c0467f
commit
c869a55b0b
|
@ -16,7 +16,7 @@ project (
|
||||||
include (CheckCCompilerFlag)
|
include (CheckCCompilerFlag)
|
||||||
include (CheckCXXCompilerFlag)
|
include (CheckCXXCompilerFlag)
|
||||||
|
|
||||||
set (CMAKE_CXX_STANDARD 17)
|
set (CMAKE_CXX_STANDARD 20)
|
||||||
set (CMAKE_CXX_STANDARD_REQUIRED ON)
|
set (CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||||
set (CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
set (CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
||||||
|
|
||||||
|
|
|
@ -471,6 +471,12 @@ class DependencyUEPlugin(Dependency):
|
||||||
super().__init__(name, *sources)
|
super().__init__(name, *sources)
|
||||||
|
|
||||||
DEFAULT_DEPENDENCIES = [
|
DEFAULT_DEPENDENCIES = [
|
||||||
|
Dependency(
|
||||||
|
'boost-asio',
|
||||||
|
GitRepository('https://github.com/boostorg/asio.git')),
|
||||||
|
Dependency(
|
||||||
|
'boost-python',
|
||||||
|
GitRepository('https://github.com/boostorg/python.git')),
|
||||||
Dependency(
|
Dependency(
|
||||||
'boost',
|
'boost',
|
||||||
Download(f'https://boostorg.jfrog.io/artifactory/main/release/{BOOST_VERSION_STRING}/source/boost_{BOOST_VERSION_MAJOR}_{BOOST_VERSION_MINOR}_{BOOST_VERSION_PATCH}.zip'),
|
Download(f'https://boostorg.jfrog.io/artifactory/main/release/{BOOST_VERSION_STRING}/source/boost_{BOOST_VERSION_MAJOR}_{BOOST_VERSION_MINOR}_{BOOST_VERSION_PATCH}.zip'),
|
||||||
|
|
|
@ -99,7 +99,7 @@ int main(int argc, const char *argv[]) {
|
||||||
// Spawn the vehicle.
|
// Spawn the vehicle.
|
||||||
auto actor = world.SpawnActor(blueprint, transform);
|
auto actor = world.SpawnActor(blueprint, transform);
|
||||||
std::cout << "Spawned " << actor->GetDisplayId() << '\n';
|
std::cout << "Spawned " << actor->GetDisplayId() << '\n';
|
||||||
auto vehicle = boost::static_pointer_cast<cc::Vehicle>(actor);
|
auto vehicle = std::static_pointer_cast<cc::Vehicle>(actor);
|
||||||
|
|
||||||
// Apply control to vehicle.
|
// Apply control to vehicle.
|
||||||
cc::Vehicle::Control control;
|
cc::Vehicle::Control control;
|
||||||
|
@ -124,11 +124,11 @@ int main(int argc, const char *argv[]) {
|
||||||
cg::Location{-5.5f, 0.0f, 2.8f}, // x, y, z.
|
cg::Location{-5.5f, 0.0f, 2.8f}, // x, y, z.
|
||||||
cg::Rotation{-15.0f, 0.0f, 0.0f}}; // pitch, yaw, roll.
|
cg::Rotation{-15.0f, 0.0f, 0.0f}}; // pitch, yaw, roll.
|
||||||
auto cam_actor = world.SpawnActor(*camera_bp, camera_transform, actor.get());
|
auto cam_actor = world.SpawnActor(*camera_bp, camera_transform, actor.get());
|
||||||
auto camera = boost::static_pointer_cast<cc::Sensor>(cam_actor);
|
auto camera = std::static_pointer_cast<cc::Sensor>(cam_actor);
|
||||||
|
|
||||||
// Register a callback to save images to disk.
|
// Register a callback to save images to disk.
|
||||||
camera->Listen([](auto data) {
|
camera->Listen([](auto data) {
|
||||||
auto image = boost::static_pointer_cast<csd::Image>(data);
|
auto image = std::static_pointer_cast<csd::Image>(data);
|
||||||
EXPECT_TRUE(image != nullptr);
|
EXPECT_TRUE(image != nullptr);
|
||||||
SaveSemSegImageToDisk(*image);
|
SaveSemSegImageToDisk(*image);
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2017 Computer Vision Center (CVC) at the Universitat Autonoma
|
// Copyright (c) 2023 Computer Vision Center (CVC) at the Universitat Autonoma
|
||||||
// de Barcelona (UAB).
|
// de Barcelona (UAB).
|
||||||
//
|
//
|
||||||
// This work is licensed under the terms of the MIT license.
|
// This work is licensed under the terms of the MIT license.
|
||||||
|
@ -30,14 +30,14 @@ namespace detail {
|
||||||
|
|
||||||
template <typename ValueT>
|
template <typename ValueT>
|
||||||
void Push(ValueT &&value) {
|
void Push(ValueT &&value) {
|
||||||
std::lock_guard<std::mutex> lock(_mutex);
|
std::scoped_lock<std::mutex> lock(_mutex);
|
||||||
auto new_list = std::make_shared<ListT>(*Load());
|
auto new_list = std::make_shared<ListT>(*Load());
|
||||||
new_list->emplace_back(std::forward<ValueT>(value));
|
new_list->emplace_back(std::forward<ValueT>(value));
|
||||||
_list = new_list;
|
_list = new_list;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DeleteByIndex(size_t index) {
|
void DeleteByIndex(size_t index) {
|
||||||
std::lock_guard<std::mutex> lock(_mutex);
|
std::scoped_lock<std::mutex> lock(_mutex);
|
||||||
auto new_list = std::make_shared<ListT>(*Load());
|
auto new_list = std::make_shared<ListT>(*Load());
|
||||||
auto begin = new_list->begin();
|
auto begin = new_list->begin();
|
||||||
std::advance(begin, index);
|
std::advance(begin, index);
|
||||||
|
@ -47,14 +47,14 @@ namespace detail {
|
||||||
|
|
||||||
template <typename ValueT>
|
template <typename ValueT>
|
||||||
void DeleteByValue(const ValueT &value) {
|
void DeleteByValue(const ValueT &value) {
|
||||||
std::lock_guard<std::mutex> lock(_mutex);
|
std::scoped_lock<std::mutex> lock(_mutex);
|
||||||
auto new_list = std::make_shared<ListT>(*Load());
|
auto new_list = std::make_shared<ListT>(*Load());
|
||||||
new_list->erase(std::remove(new_list->begin(), new_list->end(), value), new_list->end());
|
new_list->erase(std::remove(new_list->begin(), new_list->end(), value), new_list->end());
|
||||||
_list = new_list;
|
_list = new_list;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Clear() {
|
void Clear() {
|
||||||
std::lock_guard<std::mutex> lock(_mutex);
|
std::scoped_lock<std::mutex> lock(_mutex);
|
||||||
_list = std::make_shared<ListT>();
|
_list = std::make_shared<ListT>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2017 Computer Vision Center (CVC) at the Universitat Autonoma
|
// Copyright (c) 2023 Computer Vision Center (CVC) at the Universitat Autonoma
|
||||||
// de Barcelona (UAB).
|
// de Barcelona (UAB).
|
||||||
//
|
//
|
||||||
// This work is licensed under the terms of the MIT license.
|
// This work is licensed under the terms of the MIT license.
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2017 Computer Vision Center (CVC) at the Universitat Autonoma
|
// Copyright (c) 2023 Computer Vision Center (CVC) at the Universitat Autonoma
|
||||||
// de Barcelona (UAB).
|
// de Barcelona (UAB).
|
||||||
//
|
//
|
||||||
// This work is licensed under the terms of the MIT license.
|
// This work is licensed under the terms of the MIT license.
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2017 Computer Vision Center (CVC) at the Universitat Autonoma
|
// Copyright (c) 2023 Computer Vision Center (CVC) at the Universitat Autonoma
|
||||||
// de Barcelona (UAB).
|
// de Barcelona (UAB).
|
||||||
//
|
//
|
||||||
// This work is licensed under the terms of the MIT license.
|
// This work is licensed under the terms of the MIT license.
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2019 Computer Vision Center (CVC) at the Universitat Autonoma
|
// Copyright (c) 2023 Computer Vision Center (CVC) at the Universitat Autonoma
|
||||||
// de Barcelona (UAB).
|
// de Barcelona (UAB).
|
||||||
//
|
//
|
||||||
// This work is licensed under the terms of the MIT license.
|
// This work is licensed under the terms of the MIT license.
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
// Copyright (c) 2017 Computer Vision Center (CVC) at the Universitat Autonoma
|
// Copyright (c) 2023 Computer Vision Center (CVC) at the Universitat Autonoma
|
||||||
// de Barcelona (UAB).
|
// de Barcelona (UAB).
|
||||||
//
|
//
|
||||||
// This work is licensed under the terms of the MIT license.
|
// This work is licensed under the terms of the MIT license.
|
||||||
// For a copy, see <https://opensource.org/licenses/MIT>.
|
// For a copy, see <https://opensource.org/licenses/MIT>.
|
||||||
|
|
||||||
#include "carla/Exception.h"
|
#include "carla/Exception.h"
|
||||||
#include <boost/assert/source_location.hpp>
|
#include <source_location>
|
||||||
|
|
||||||
// =============================================================================
|
// =============================================================================
|
||||||
// -- Define boost::throw_exception --------------------------------------------
|
// -- Define boost::throw_exception --------------------------------------------
|
||||||
|
@ -15,13 +15,15 @@
|
||||||
|
|
||||||
namespace boost {
|
namespace boost {
|
||||||
|
|
||||||
void throw_exception(const std::exception &e) {
|
void throw_exception(const std::exception &e)
|
||||||
|
{
|
||||||
carla::throw_exception(e);
|
carla::throw_exception(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
void throw_exception(
|
void throw_exception(
|
||||||
const std::exception &e,
|
const std::exception &e,
|
||||||
boost::source_location const & loc) {
|
std::source_location const& loc)
|
||||||
|
{
|
||||||
throw_exception(e);
|
throw_exception(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2017 Computer Vision Center (CVC) at the Universitat Autonoma
|
// Copyright (c) 2023 Computer Vision Center (CVC) at the Universitat Autonoma
|
||||||
// de Barcelona (UAB).
|
// de Barcelona (UAB).
|
||||||
//
|
//
|
||||||
// This work is licensed under the terms of the MIT license.
|
// This work is licensed under the terms of the MIT license.
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2017 Computer Vision Center (CVC) at the Universitat Autonoma
|
// Copyright (c) 2023 Computer Vision Center (CVC) at the Universitat Autonoma
|
||||||
// de Barcelona (UAB).
|
// de Barcelona (UAB).
|
||||||
//
|
//
|
||||||
// This work is licensed under the terms of the MIT license.
|
// This work is licensed under the terms of the MIT license.
|
||||||
|
@ -9,11 +9,11 @@
|
||||||
#include "carla/Exception.h"
|
#include "carla/Exception.h"
|
||||||
#include "carla/StringUtil.h"
|
#include "carla/StringUtil.h"
|
||||||
|
|
||||||
#include <boost/filesystem/operations.hpp>
|
#include <filesystem>
|
||||||
|
|
||||||
namespace carla {
|
namespace carla {
|
||||||
|
|
||||||
namespace fs = boost::filesystem;
|
namespace fs = std::filesystem;
|
||||||
|
|
||||||
void FileSystem::ValidateFilePath(std::string &filepath, const std::string &ext) {
|
void FileSystem::ValidateFilePath(std::string &filepath, const std::string &ext) {
|
||||||
fs::path path(filepath);
|
fs::path path(filepath);
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2017 Computer Vision Center (CVC) at the Universitat Autonoma
|
// Copyright (c) 2023 Computer Vision Center (CVC) at the Universitat Autonoma
|
||||||
// de Barcelona (UAB).
|
// de Barcelona (UAB).
|
||||||
//
|
//
|
||||||
// This work is licensed under the terms of the MIT license.
|
// This work is licensed under the terms of the MIT license.
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2017 Computer Vision Center (CVC) at the Universitat Autonoma
|
// Copyright (c) 2023 Computer Vision Center (CVC) at the Universitat Autonoma
|
||||||
// de Barcelona (UAB).
|
// de Barcelona (UAB).
|
||||||
//
|
//
|
||||||
// This work is licensed under the terms of the MIT license.
|
// This work is licensed under the terms of the MIT license.
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2017 Computer Vision Center (CVC) at the Universitat Autonoma
|
// Copyright (c) 2023 Computer Vision Center (CVC) at the Universitat Autonoma
|
||||||
// de Barcelona (UAB).
|
// de Barcelona (UAB).
|
||||||
//
|
//
|
||||||
// This work is licensed under the terms of the MIT license.
|
// This work is licensed under the terms of the MIT license.
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2017 Computer Vision Center (CVC) at the Universitat Autonoma
|
// Copyright (c) 2023 Computer Vision Center (CVC) at the Universitat Autonoma
|
||||||
// de Barcelona (UAB).
|
// de Barcelona (UAB).
|
||||||
//
|
//
|
||||||
// This work is licensed under the terms of the MIT license.
|
// This work is licensed under the terms of the MIT license.
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2017 Computer Vision Center (CVC) at the Universitat Autonoma
|
// Copyright (c) 2023 Computer Vision Center (CVC) at the Universitat Autonoma
|
||||||
// de Barcelona (UAB).
|
// de Barcelona (UAB).
|
||||||
//
|
//
|
||||||
// This work is licensed under the terms of the MIT license.
|
// This work is licensed under the terms of the MIT license.
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2019 Computer Vision Center (CVC) at the Universitat Autonoma
|
// Copyright (c) 2023 Computer Vision Center (CVC) at the Universitat Autonoma
|
||||||
// de Barcelona (UAB).
|
// de Barcelona (UAB).
|
||||||
//
|
//
|
||||||
// This work is licensed under the terms of the MIT license.
|
// This work is licensed under the terms of the MIT license.
|
||||||
|
@ -6,28 +6,26 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <boost/enable_shared_from_this.hpp>
|
#include <memory>
|
||||||
#include <boost/make_shared.hpp>
|
#include <utility>
|
||||||
#include <boost/shared_ptr.hpp>
|
|
||||||
#include <boost/weak_ptr.hpp>
|
|
||||||
|
|
||||||
namespace carla {
|
namespace carla {
|
||||||
|
|
||||||
/// Use this SharedPtr (boost::shared_ptr) to keep compatibility with
|
/// Use this SharedPtr (std::shared_ptr) to keep compatibility with
|
||||||
/// boost::python, but it would be nice if in the future we can make a Python
|
/// boost::python, but it would be nice if in the future we can make a Python
|
||||||
/// adaptor for std::shared_ptr.
|
/// adaptor for std::shared_ptr.
|
||||||
template <typename T>
|
template <typename T>
|
||||||
using SharedPtr = boost::shared_ptr<T>;
|
using SharedPtr = std::shared_ptr<T>;
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
using WeakPtr = boost::weak_ptr<T>;
|
using WeakPtr = std::weak_ptr<T>;
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
using EnableSharedFromThis = boost::enable_shared_from_this<T>;
|
using EnableSharedFromThis = std::enable_shared_from_this<T>;
|
||||||
|
|
||||||
template <typename T, typename... Args>
|
template <typename T, typename... Args>
|
||||||
static inline auto MakeShared(Args &&... args) {
|
static inline auto MakeShared(Args &&... args) {
|
||||||
return boost::make_shared<T>(std::forward<Args>(args)...);
|
return std::make_shared<T>(std::forward<Args>(args)...);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace carla
|
} // namespace carla
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2019 Computer Vision Center (CVC) at the Universitat Autonoma
|
// Copyright (c) 2023 Computer Vision Center (CVC) at the Universitat Autonoma
|
||||||
// de Barcelona (UAB).
|
// de Barcelona (UAB).
|
||||||
//
|
//
|
||||||
// This work is licensed under the terms of the MIT license.
|
// This work is licensed under the terms of the MIT license.
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2017 Computer Vision Center (CVC) at the Universitat Autonoma
|
// Copyright (c) 2023 Computer Vision Center (CVC) at the Universitat Autonoma
|
||||||
// de Barcelona (UAB).
|
// de Barcelona (UAB).
|
||||||
//
|
//
|
||||||
// This work is licensed under the terms of the MIT license.
|
// This work is licensed under the terms of the MIT license.
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2017 Computer Vision Center (CVC) at the Universitat Autonoma
|
// Copyright (c) 2023 Computer Vision Center (CVC) at the Universitat Autonoma
|
||||||
// de Barcelona (UAB).
|
// de Barcelona (UAB).
|
||||||
//
|
//
|
||||||
// This work is licensed under the terms of the MIT license.
|
// This work is licensed under the terms of the MIT license.
|
||||||
|
@ -9,16 +9,16 @@
|
||||||
#include "carla/Exception.h"
|
#include "carla/Exception.h"
|
||||||
#include "carla/MsgPack.h"
|
#include "carla/MsgPack.h"
|
||||||
|
|
||||||
#include <boost/optional.hpp>
|
#include <optional>
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
#pragma warning(push)
|
#pragma warning(push)
|
||||||
#pragma warning(disable:4583)
|
#pragma warning(disable:4583)
|
||||||
#pragma warning(disable:4582)
|
#pragma warning(disable:4582)
|
||||||
#include <boost/variant2/variant.hpp>
|
#include <variant>
|
||||||
#pragma warning(pop)
|
#pragma warning(pop)
|
||||||
#else
|
#else
|
||||||
#include <boost/variant2/variant.hpp>
|
#include <variant>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <tuple>
|
#include <tuple>
|
||||||
|
@ -28,21 +28,21 @@ MSGPACK_API_VERSION_NAMESPACE(MSGPACK_DEFAULT_API_NS) {
|
||||||
namespace adaptor {
|
namespace adaptor {
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
// -- Adaptors for boost::optional -------------------------------------------
|
// -- Adaptors for std::optional -------------------------------------------
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
struct convert<boost::optional<T>> {
|
struct convert<std::optional<T>> {
|
||||||
const clmdep_msgpack::object &operator()(
|
const clmdep_msgpack::object &operator()(
|
||||||
const clmdep_msgpack::object &o,
|
const clmdep_msgpack::object &o,
|
||||||
boost::optional<T> &v) const {
|
std::optional<T> &v) const {
|
||||||
if (o.type != clmdep_msgpack::type::ARRAY) {
|
if (o.type != clmdep_msgpack::type::ARRAY) {
|
||||||
::carla::throw_exception(clmdep_msgpack::type_error());
|
::carla::throw_exception(clmdep_msgpack::type_error());
|
||||||
}
|
}
|
||||||
if (o.via.array.size == 1) {
|
if (o.via.array.size == 1) {
|
||||||
v.reset();
|
v.reset();
|
||||||
} else if (o.via.array.size == 2) {
|
} else if (o.via.array.size == 2) {
|
||||||
v.reset(o.via.array.ptr[1].as<T>());
|
v = o.via.array.ptr[1].as<T>();
|
||||||
} else {
|
} else {
|
||||||
::carla::throw_exception(clmdep_msgpack::type_error());
|
::carla::throw_exception(clmdep_msgpack::type_error());
|
||||||
}
|
}
|
||||||
|
@ -51,11 +51,11 @@ namespace adaptor {
|
||||||
};
|
};
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
struct pack<boost::optional<T>> {
|
struct pack<std::optional<T>> {
|
||||||
template <typename Stream>
|
template <typename Stream>
|
||||||
packer<Stream> &operator()(
|
packer<Stream> &operator()(
|
||||||
clmdep_msgpack::packer<Stream> &o,
|
clmdep_msgpack::packer<Stream> &o,
|
||||||
const boost::optional<T> &v) const {
|
const std::optional<T> &v) const {
|
||||||
if (v.has_value()) {
|
if (v.has_value()) {
|
||||||
o.pack_array(2);
|
o.pack_array(2);
|
||||||
o.pack(true);
|
o.pack(true);
|
||||||
|
@ -69,10 +69,10 @@ namespace adaptor {
|
||||||
};
|
};
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
struct object_with_zone<boost::optional<T>> {
|
struct object_with_zone<std::optional<T>> {
|
||||||
void operator()(
|
void operator()(
|
||||||
clmdep_msgpack::object::with_zone &o,
|
clmdep_msgpack::object::with_zone &o,
|
||||||
const boost::optional<T> &v) const {
|
const std::optional<T> &v) const {
|
||||||
o.type = type::ARRAY;
|
o.type = type::ARRAY;
|
||||||
if (v.has_value()) {
|
if (v.has_value()) {
|
||||||
o.via.array.size = 2;
|
o.via.array.size = 2;
|
||||||
|
@ -92,15 +92,15 @@ namespace adaptor {
|
||||||
};
|
};
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
// -- Adaptors for boost::variant2::variant ----------------------------------
|
// -- Adaptors for std::variant ----------------------------------
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
template<typename... Ts>
|
template<typename... Ts>
|
||||||
struct convert<boost::variant2::variant<Ts...>> {
|
struct convert<std::variant<Ts...>> {
|
||||||
|
|
||||||
const clmdep_msgpack::object &operator()(
|
const clmdep_msgpack::object &operator()(
|
||||||
const clmdep_msgpack::object &o,
|
const clmdep_msgpack::object &o,
|
||||||
boost::variant2::variant<Ts...> &v) const {
|
std::variant<Ts...> &v) const {
|
||||||
if (o.type != clmdep_msgpack::type::ARRAY) {
|
if (o.type != clmdep_msgpack::type::ARRAY) {
|
||||||
::carla::throw_exception(clmdep_msgpack::type_error());
|
::carla::throw_exception(clmdep_msgpack::type_error());
|
||||||
}
|
}
|
||||||
|
@ -117,7 +117,7 @@ namespace adaptor {
|
||||||
template <uint64_t I>
|
template <uint64_t I>
|
||||||
static void copy_to_variant_impl(
|
static void copy_to_variant_impl(
|
||||||
const clmdep_msgpack::object &o,
|
const clmdep_msgpack::object &o,
|
||||||
boost::variant2::variant<Ts...> &v) {
|
std::variant<Ts...> &v) {
|
||||||
/// @todo Workaround for finding the type.
|
/// @todo Workaround for finding the type.
|
||||||
auto dummy = std::get<I>(std::tuple<Ts...>{});
|
auto dummy = std::get<I>(std::tuple<Ts...>{});
|
||||||
using T = decltype(dummy);
|
using T = decltype(dummy);
|
||||||
|
@ -128,7 +128,7 @@ namespace adaptor {
|
||||||
static void copy_to_variant(
|
static void copy_to_variant(
|
||||||
const uint64_t index,
|
const uint64_t index,
|
||||||
const clmdep_msgpack::object &o,
|
const clmdep_msgpack::object &o,
|
||||||
boost::variant2::variant<Ts...> &v,
|
std::variant<Ts...> &v,
|
||||||
std::index_sequence<Is...>) {
|
std::index_sequence<Is...>) {
|
||||||
std::initializer_list<int> ({
|
std::initializer_list<int> ({
|
||||||
(index == Is ? copy_to_variant_impl<Is>(o, v), 0 : 0)...
|
(index == Is ? copy_to_variant_impl<Is>(o, v), 0 : 0)...
|
||||||
|
@ -137,30 +137,30 @@ namespace adaptor {
|
||||||
};
|
};
|
||||||
|
|
||||||
template<typename... Ts>
|
template<typename... Ts>
|
||||||
struct pack<boost::variant2::variant<Ts...>> {
|
struct pack<std::variant<Ts...>> {
|
||||||
template <typename Stream>
|
template <typename Stream>
|
||||||
packer<Stream> &operator()(
|
packer<Stream> &operator()(
|
||||||
clmdep_msgpack::packer<Stream> &o,
|
clmdep_msgpack::packer<Stream> &o,
|
||||||
const boost::variant2::variant<Ts...> &v) const {
|
const std::variant<Ts...> &v) const {
|
||||||
o.pack_array(2);
|
o.pack_array(2);
|
||||||
o.pack(static_cast<uint64_t>(v.index()));
|
o.pack(static_cast<uint64_t>(v.index()));
|
||||||
boost::variant2::visit([&](const auto &value) { o.pack(value); }, v);
|
std::visit([&](const auto &value) { o.pack(value); }, v);
|
||||||
return o;
|
return o;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
template<typename... Ts>
|
template<typename... Ts>
|
||||||
struct object_with_zone<boost::variant2::variant<Ts...>> {
|
struct object_with_zone<std::variant<Ts...>> {
|
||||||
void operator()(
|
void operator()(
|
||||||
clmdep_msgpack::object::with_zone &o,
|
clmdep_msgpack::object::with_zone &o,
|
||||||
const boost::variant2::variant<Ts...> &v) const {
|
const std::variant<Ts...> &v) const {
|
||||||
o.type = type::ARRAY;
|
o.type = type::ARRAY;
|
||||||
o.via.array.size = 2;
|
o.via.array.size = 2;
|
||||||
o.via.array.ptr = static_cast<clmdep_msgpack::object*>(o.zone.allocate_align(
|
o.via.array.ptr = static_cast<clmdep_msgpack::object*>(o.zone.allocate_align(
|
||||||
sizeof(clmdep_msgpack::object) * o.via.array.size,
|
sizeof(clmdep_msgpack::object) * o.via.array.size,
|
||||||
MSGPACK_ZONE_ALIGNOF(clmdep_msgpack::object)));
|
MSGPACK_ZONE_ALIGNOF(clmdep_msgpack::object)));
|
||||||
o.via.array.ptr[0] = clmdep_msgpack::object(static_cast<uint64_t>(v.index()), o.zone);
|
o.via.array.ptr[0] = clmdep_msgpack::object(static_cast<uint64_t>(v.index()), o.zone);
|
||||||
boost::variant2::visit([&](const auto &value) {
|
std::visit([&](const auto &value) {
|
||||||
o.via.array.ptr[1] = clmdep_msgpack::object(value, o.zone);
|
o.via.array.ptr[1] = clmdep_msgpack::object(value, o.zone);
|
||||||
}, v);
|
}, v);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2017 Computer Vision Center (CVC) at the Universitat Autonoma
|
// Copyright (c) 2023 Computer Vision Center (CVC) at the Universitat Autonoma
|
||||||
// de Barcelona (UAB).
|
// de Barcelona (UAB).
|
||||||
//
|
//
|
||||||
// This work is licensed under the terms of the MIT license.
|
// This work is licensed under the terms of the MIT license.
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2017 Computer Vision Center (CVC) at the Universitat Autonoma
|
// Copyright (c) 2023 Computer Vision Center (CVC) at the Universitat Autonoma
|
||||||
// de Barcelona (UAB).
|
// de Barcelona (UAB).
|
||||||
//
|
//
|
||||||
// This work is licensed under the terms of the MIT license.
|
// This work is licensed under the terms of the MIT license.
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2017 Computer Vision Center (CVC) at the Universitat Autonoma
|
// Copyright (c) 2023 Computer Vision Center (CVC) at the Universitat Autonoma
|
||||||
// de Barcelona (UAB).
|
// de Barcelona (UAB).
|
||||||
//
|
//
|
||||||
// This work is licensed under the terms of the MIT license.
|
// This work is licensed under the terms of the MIT license.
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2017 Computer Vision Center (CVC) at the Universitat Autonoma
|
// Copyright (c) 2023 Computer Vision Center (CVC) at the Universitat Autonoma
|
||||||
// de Barcelona (UAB).
|
// de Barcelona (UAB).
|
||||||
//
|
//
|
||||||
// This work is licensed under the terms of the MIT license.
|
// This work is licensed under the terms of the MIT license.
|
||||||
|
@ -9,15 +9,15 @@
|
||||||
#include "carla/Exception.h"
|
#include "carla/Exception.h"
|
||||||
#include "carla/Time.h"
|
#include "carla/Time.h"
|
||||||
|
|
||||||
#include <boost/optional.hpp>
|
#include <optional>
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
#pragma warning(push)
|
#pragma warning(push)
|
||||||
#pragma warning(disable:4583)
|
#pragma warning(disable:4583)
|
||||||
#pragma warning(disable:4582)
|
#pragma warning(disable:4582)
|
||||||
#include <boost/variant2/variant.hpp>
|
#include <variant>
|
||||||
#pragma warning(pop)
|
#pragma warning(pop)
|
||||||
#else
|
#else
|
||||||
#include <boost/variant2/variant.hpp>
|
#include <variant>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <condition_variable>
|
#include <condition_variable>
|
||||||
|
@ -49,7 +49,7 @@ namespace detail {
|
||||||
/// simultaneously.
|
/// simultaneously.
|
||||||
///
|
///
|
||||||
/// @return empty optional if the timeout is met.
|
/// @return empty optional if the timeout is met.
|
||||||
boost::optional<T> WaitFor(time_duration timeout);
|
std::optional<T> WaitFor(time_duration timeout);
|
||||||
|
|
||||||
/// Set the value and notify all waiting threads.
|
/// Set the value and notify all waiting threads.
|
||||||
template <typename T2>
|
template <typename T2>
|
||||||
|
@ -71,7 +71,7 @@ namespace detail {
|
||||||
|
|
||||||
struct mapped_type {
|
struct mapped_type {
|
||||||
bool should_wait;
|
bool should_wait;
|
||||||
boost::variant2::variant<SharedException, T> value;
|
std::variant<SharedException, T> value;
|
||||||
};
|
};
|
||||||
|
|
||||||
std::map<const char *, mapped_type> _map;
|
std::map<const char *, mapped_type> _map;
|
||||||
|
@ -110,7 +110,7 @@ namespace detail {
|
||||||
} // namespace detail
|
} // namespace detail
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
boost::optional<T> RecurrentSharedFuture<T>::WaitFor(time_duration timeout) {
|
std::optional<T> RecurrentSharedFuture<T>::WaitFor(time_duration timeout) {
|
||||||
std::unique_lock<std::mutex> lock(_mutex);
|
std::unique_lock<std::mutex> lock(_mutex);
|
||||||
auto &r = _map[&detail::thread_tag];
|
auto &r = _map[&detail::thread_tag];
|
||||||
r.should_wait = true;
|
r.should_wait = true;
|
||||||
|
@ -118,15 +118,15 @@ namespace detail {
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
if (r.value.index() == 0) {
|
if (r.value.index() == 0) {
|
||||||
throw_exception(boost::variant2::get<SharedException>(r.value));
|
throw_exception(std::get<SharedException>(r.value));
|
||||||
}
|
}
|
||||||
return boost::variant2::get<T>(std::move(r.value));
|
return std::get<T>(std::move(r.value));
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
template <typename T2>
|
template <typename T2>
|
||||||
void RecurrentSharedFuture<T>::SetValue(const T2 &value) {
|
void RecurrentSharedFuture<T>::SetValue(const T2 &value) {
|
||||||
std::lock_guard<std::mutex> lock(_mutex);
|
std::scoped_lock<std::mutex> lock(_mutex);
|
||||||
for (auto &pair : _map) {
|
for (auto &pair : _map) {
|
||||||
pair.second.should_wait = false;
|
pair.second.should_wait = false;
|
||||||
pair.second.value = value;
|
pair.second.value = value;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2020 Computer Vision Center (CVC) at the Universitat Autonoma
|
// Copyright (c) 2023 Computer Vision Center (CVC) at the Universitat Autonoma
|
||||||
// de Barcelona (UAB).
|
// de Barcelona (UAB).
|
||||||
//
|
//
|
||||||
// This work is licensed under the terms of the MIT license.
|
// This work is licensed under the terms of the MIT license.
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2017 Computer Vision Center (CVC) at the Universitat Autonoma
|
// Copyright (c) 2023 Computer Vision Center (CVC) at the Universitat Autonoma
|
||||||
// de Barcelona (UAB).
|
// de Barcelona (UAB).
|
||||||
//
|
//
|
||||||
// This work is licensed under the terms of the MIT license.
|
// This work is licensed under the terms of the MIT license.
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2017 Computer Vision Center (CVC) at the Universitat Autonoma
|
// Copyright (c) 2023 Computer Vision Center (CVC) at the Universitat Autonoma
|
||||||
// de Barcelona (UAB).
|
// de Barcelona (UAB).
|
||||||
//
|
//
|
||||||
// This work is licensed under the terms of the MIT license.
|
// This work is licensed under the terms of the MIT license.
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2017 Computer Vision Center (CVC) at the Universitat Autonoma
|
// Copyright (c) 2023 Computer Vision Center (CVC) at the Universitat Autonoma
|
||||||
// de Barcelona (UAB).
|
// de Barcelona (UAB).
|
||||||
//
|
//
|
||||||
// This work is licensed under the terms of the MIT license.
|
// This work is licensed under the terms of the MIT license.
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2017 Computer Vision Center (CVC) at the Universitat Autonoma
|
// Copyright (c) 2023 Computer Vision Center (CVC) at the Universitat Autonoma
|
||||||
// de Barcelona (UAB).
|
// de Barcelona (UAB).
|
||||||
//
|
//
|
||||||
// This work is licensed under the terms of the MIT license.
|
// This work is licensed under the terms of the MIT license.
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2019 Computer Vision Center (CVC) at the Universitat Autonoma
|
// Copyright (c) 2023 Computer Vision Center (CVC) at the Universitat Autonoma
|
||||||
// de Barcelona (UAB).
|
// de Barcelona (UAB).
|
||||||
//
|
//
|
||||||
// This work is licensed under the terms of the MIT license.
|
// This work is licensed under the terms of the MIT license.
|
||||||
|
@ -39,12 +39,7 @@ namespace carla {
|
||||||
/// Post a task to the pool.
|
/// Post a task to the pool.
|
||||||
template <
|
template <
|
||||||
typename FunctorT,
|
typename FunctorT,
|
||||||
#if __cplusplus < 201703L
|
typename ResultT = typename std::invoke_result_t<FunctorT()>>
|
||||||
typename ResultT = typename std::result_of_t<FunctorT()>
|
|
||||||
#else
|
|
||||||
typename ResultT = typename std::invoke_result_t<FunctorT()>
|
|
||||||
#endif
|
|
||||||
>
|
|
||||||
std::future<ResultT> Post(FunctorT &&functor) {
|
std::future<ResultT> Post(FunctorT &&functor) {
|
||||||
auto task = std::packaged_task<ResultT()>(std::forward<FunctorT>(functor));
|
auto task = std::packaged_task<ResultT()>(std::forward<FunctorT>(functor));
|
||||||
auto future = task.get_future();
|
auto future = task.get_future();
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2017 Computer Vision Center (CVC) at the Universitat Autonoma
|
// Copyright (c) 2023 Computer Vision Center (CVC) at the Universitat Autonoma
|
||||||
// de Barcelona (UAB).
|
// de Barcelona (UAB).
|
||||||
//
|
//
|
||||||
// This work is licensed under the terms of the MIT license.
|
// This work is licensed under the terms of the MIT license.
|
||||||
|
@ -7,11 +7,12 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "carla/Debug.h"
|
#include "carla/Debug.h"
|
||||||
|
|
||||||
#include <boost/date_time/posix_time/posix_time_types.hpp>
|
|
||||||
|
|
||||||
#include <chrono>
|
#include <chrono>
|
||||||
|
|
||||||
|
#if __has_include(<boost/date_time/posix_time/posix_time_types.hpp>)
|
||||||
|
#include <boost/date_time/posix_time/posix_time_types.hpp>
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace carla {
|
namespace carla {
|
||||||
|
|
||||||
/// Positive time duration up to milliseconds resolution. Automatically casts
|
/// Positive time duration up to milliseconds resolution. Automatically casts
|
||||||
|
@ -36,16 +37,19 @@ namespace carla {
|
||||||
DEBUG_ASSERT(count >= 0);
|
DEBUG_ASSERT(count >= 0);
|
||||||
return static_cast<size_t>(count);
|
return static_cast<size_t>(count);
|
||||||
}()) {}
|
}()) {}
|
||||||
|
|
||||||
time_duration(boost::posix_time::time_duration timeout)
|
|
||||||
: time_duration(std::chrono::milliseconds(timeout.total_milliseconds())) {}
|
|
||||||
|
|
||||||
time_duration(const time_duration &) = default;
|
time_duration(const time_duration &) = default;
|
||||||
time_duration &operator=(const time_duration &) = default;
|
time_duration &operator=(const time_duration &) = default;
|
||||||
|
|
||||||
|
#if __has_include(<boost/date_time/posix_time/posix_time_types.hpp>)
|
||||||
|
time_duration(boost::posix_time::time_duration timeout)
|
||||||
|
: time_duration(std::chrono::milliseconds(timeout.total_milliseconds()))
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
boost::posix_time::time_duration to_posix_time() const {
|
boost::posix_time::time_duration to_posix_time() const {
|
||||||
return boost::posix_time::milliseconds(_milliseconds);
|
return boost::posix_time::milliseconds(_milliseconds);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
constexpr auto to_chrono() const {
|
constexpr auto to_chrono() const {
|
||||||
return std::chrono::milliseconds(_milliseconds);
|
return std::chrono::milliseconds(_milliseconds);
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2017 Computer Vision Center (CVC) at the Universitat Autonoma
|
// Copyright (c) 2023 Computer Vision Center (CVC) at the Universitat Autonoma
|
||||||
// de Barcelona (UAB).
|
// de Barcelona (UAB).
|
||||||
//
|
//
|
||||||
// This work is licensed under the terms of the MIT license.
|
// This work is licensed under the terms of the MIT license.
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2017 Computer Vision Center (CVC) at the Universitat Autonoma
|
// Copyright (c) 2023 Computer Vision Center (CVC) at the Universitat Autonoma
|
||||||
// de Barcelona (UAB).
|
// de Barcelona (UAB).
|
||||||
//
|
//
|
||||||
// This work is licensed under the terms of the MIT license.
|
// This work is licensed under the terms of the MIT license.
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2017 Computer Vision Center (CVC) at the Universitat Autonoma
|
// Copyright (c) 2023 Computer Vision Center (CVC) at the Universitat Autonoma
|
||||||
// de Barcelona (UAB).
|
// de Barcelona (UAB).
|
||||||
//
|
//
|
||||||
// This work is licensed under the terms of the MIT license.
|
// This work is licensed under the terms of the MIT license.
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2017 Computer Vision Center (CVC) at the Universitat Autonoma
|
// Copyright (c) 2023 Computer Vision Center (CVC) at the Universitat Autonoma
|
||||||
// de Barcelona (UAB).
|
// de Barcelona (UAB).
|
||||||
//
|
//
|
||||||
// This work is licensed under the terms of the MIT license.
|
// This work is licensed under the terms of the MIT license.
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2017 Computer Vision Center (CVC) at the Universitat Autonoma
|
// Copyright (c) 2023 Computer Vision Center (CVC) at the Universitat Autonoma
|
||||||
// de Barcelona (UAB).
|
// de Barcelona (UAB).
|
||||||
//
|
//
|
||||||
// This work is licensed under the terms of the MIT license.
|
// This work is licensed under the terms of the MIT license.
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2017 Computer Vision Center (CVC) at the Universitat Autonoma
|
// Copyright (c) 2023 Computer Vision Center (CVC) at the Universitat Autonoma
|
||||||
// de Barcelona (UAB).
|
// de Barcelona (UAB).
|
||||||
//
|
//
|
||||||
// This work is licensed under the terms of the MIT license.
|
// This work is licensed under the terms of the MIT license.
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2017 Computer Vision Center (CVC) at the Universitat Autonoma
|
// Copyright (c) 2023 Computer Vision Center (CVC) at the Universitat Autonoma
|
||||||
// de Barcelona (UAB).
|
// de Barcelona (UAB).
|
||||||
//
|
//
|
||||||
// This work is licensed under the terms of the MIT license.
|
// This work is licensed under the terms of the MIT license.
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2017 Computer Vision Center (CVC) at the Universitat Autonoma
|
// Copyright (c) 2023 Computer Vision Center (CVC) at the Universitat Autonoma
|
||||||
// de Barcelona (UAB).
|
// de Barcelona (UAB).
|
||||||
//
|
//
|
||||||
// This work is licensed under the terms of the MIT license.
|
// This work is licensed under the terms of the MIT license.
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2017 Computer Vision Center (CVC) at the Universitat Autonoma
|
// Copyright (c) 2023 Computer Vision Center (CVC) at the Universitat Autonoma
|
||||||
// de Barcelona (UAB).
|
// de Barcelona (UAB).
|
||||||
//
|
//
|
||||||
// This work is licensed under the terms of the MIT license.
|
// This work is licensed under the terms of the MIT license.
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2021 Computer Vision Center (CVC) at the Universitat Autonoma
|
// Copyright (c) 2023 Computer Vision Center (CVC) at the Universitat Autonoma
|
||||||
// de Barcelona (UAB).
|
// de Barcelona (UAB).
|
||||||
//
|
//
|
||||||
// This work is licensed under the terms of the MIT license.
|
// This work is licensed under the terms of the MIT license.
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2017 Computer Vision Center (CVC) at the Universitat Autonoma
|
// Copyright (c) 2023 Computer Vision Center (CVC) at the Universitat Autonoma
|
||||||
// de Barcelona (UAB).
|
// de Barcelona (UAB).
|
||||||
//
|
//
|
||||||
// This work is licensed under the terms of the MIT license.
|
// This work is licensed under the terms of the MIT license.
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2017 Computer Vision Center (CVC) at the Universitat Autonoma
|
// Copyright (c) 2023 Computer Vision Center (CVC) at the Universitat Autonoma
|
||||||
// de Barcelona (UAB).
|
// de Barcelona (UAB).
|
||||||
//
|
//
|
||||||
// This work is licensed under the terms of the MIT license.
|
// This work is licensed under the terms of the MIT license.
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2017 Computer Vision Center (CVC) at the Universitat Autonoma
|
// Copyright (c) 2023 Computer Vision Center (CVC) at the Universitat Autonoma
|
||||||
// de Barcelona (UAB).
|
// de Barcelona (UAB).
|
||||||
//
|
//
|
||||||
// This work is licensed under the terms of the MIT license.
|
// This work is licensed under the terms of the MIT license.
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2017 Computer Vision Center (CVC) at the Universitat Autonoma
|
// Copyright (c) 2023 Computer Vision Center (CVC) at the Universitat Autonoma
|
||||||
// de Barcelona (UAB).
|
// de Barcelona (UAB).
|
||||||
//
|
//
|
||||||
// This work is licensed under the terms of the MIT license.
|
// This work is licensed under the terms of the MIT license.
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2017 Computer Vision Center (CVC) at the Universitat Autonoma
|
// Copyright (c) 2023 Computer Vision Center (CVC) at the Universitat Autonoma
|
||||||
// de Barcelona (UAB).
|
// de Barcelona (UAB).
|
||||||
//
|
//
|
||||||
// This work is licensed under the terms of the MIT license.
|
// This work is licensed under the terms of the MIT license.
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2017 Computer Vision Center (CVC) at the Universitat Autonoma
|
// Copyright (c) 2023 Computer Vision Center (CVC) at the Universitat Autonoma
|
||||||
// de Barcelona (UAB).
|
// de Barcelona (UAB).
|
||||||
//
|
//
|
||||||
// This work is licensed under the terms of the MIT license.
|
// This work is licensed under the terms of the MIT license.
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2021 Computer Vision Center (CVC) at the Universitat Autonoma
|
// Copyright (c) 2023 Computer Vision Center (CVC) at the Universitat Autonoma
|
||||||
// de Barcelona (UAB).
|
// de Barcelona (UAB).
|
||||||
//
|
//
|
||||||
// This work is licensed under the terms of the MIT license.
|
// This work is licensed under the terms of the MIT license.
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2021 Computer Vision Center (CVC) at the Universitat Autonoma
|
// Copyright (c) 2023 Computer Vision Center (CVC) at the Universitat Autonoma
|
||||||
// de Barcelona (UAB).
|
// de Barcelona (UAB).
|
||||||
//
|
//
|
||||||
// This work is licensed under the terms of the MIT license.
|
// This work is licensed under the terms of the MIT license.
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2017 Computer Vision Center (CVC) at the Universitat Autonoma
|
// Copyright (c) 2023 Computer Vision Center (CVC) at the Universitat Autonoma
|
||||||
// de Barcelona (UAB).
|
// de Barcelona (UAB).
|
||||||
//
|
//
|
||||||
// This work is licensed under the terms of the MIT license.
|
// This work is licensed under the terms of the MIT license.
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2020 Computer Vision Center (CVC) at the Universitat Autonoma
|
// Copyright (c) 2023 Computer Vision Center (CVC) at the Universitat Autonoma
|
||||||
// de Barcelona (UAB).
|
// de Barcelona (UAB).
|
||||||
//
|
//
|
||||||
// This work is licensed under the terms of the MIT license.
|
// This work is licensed under the terms of the MIT license.
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2020 Computer Vision Center (CVC) at the Universitat Autonoma
|
// Copyright (c) 2023 Computer Vision Center (CVC) at the Universitat Autonoma
|
||||||
// de Barcelona (UAB).
|
// de Barcelona (UAB).
|
||||||
//
|
//
|
||||||
// This work is licensed under the terms of the MIT license.
|
// This work is licensed under the terms of the MIT license.
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2020 Computer Vision Center (CVC) at the Universitat Autonoma
|
// Copyright (c) 2023 Computer Vision Center (CVC) at the Universitat Autonoma
|
||||||
// de Barcelona (UAB).
|
// de Barcelona (UAB).
|
||||||
//
|
//
|
||||||
// This work is licensed under the terms of the MIT license.
|
// This work is licensed under the terms of the MIT license.
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2019 Computer Vision Center (CVC) at the Universitat Autonoma
|
// Copyright (c) 2023 Computer Vision Center (CVC) at the Universitat Autonoma
|
||||||
// de Barcelona (UAB).
|
// de Barcelona (UAB).
|
||||||
//
|
//
|
||||||
// This work is licensed under the terms of the MIT license.
|
// This work is licensed under the terms of the MIT license.
|
||||||
|
@ -144,7 +144,7 @@ namespace client {
|
||||||
}
|
}
|
||||||
|
|
||||||
void LaneInvasionSensor::Listen(CallbackFunctionType callback) {
|
void LaneInvasionSensor::Listen(CallbackFunctionType callback) {
|
||||||
auto vehicle = boost::dynamic_pointer_cast<Vehicle>(GetParent());
|
auto vehicle = std::dynamic_pointer_cast<Vehicle>(GetParent());
|
||||||
if (vehicle == nullptr) {
|
if (vehicle == nullptr) {
|
||||||
log_error(GetDisplayId(), ": not attached to a vehicle");
|
log_error(GetDisplayId(), ": not attached to a vehicle");
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2019 Computer Vision Center (CVC) at the Universitat Autonoma
|
// Copyright (c) 2023 Computer Vision Center (CVC) at the Universitat Autonoma
|
||||||
// de Barcelona (UAB).
|
// de Barcelona (UAB).
|
||||||
//
|
//
|
||||||
// This work is licensed under the terms of the MIT license.
|
// This work is licensed under the terms of the MIT license.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
|
|
||||||
// Copyright (c) 2020 Computer Vision Center (CVC) at the Universitat Autonoma
|
// Copyright (c) 2023 Computer Vision Center (CVC) at the Universitat Autonoma
|
||||||
// de Barcelona (UAB).
|
// de Barcelona (UAB).
|
||||||
//
|
//
|
||||||
// This work is licensed under the terms of the MIT license.
|
// This work is licensed under the terms of the MIT license.
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2020 Computer Vision Center (CVC) at the Universitat Autonoma
|
// Copyright (c) 2023 Computer Vision Center (CVC) at the Universitat Autonoma
|
||||||
// de Barcelona (UAB).
|
// de Barcelona (UAB).
|
||||||
//
|
//
|
||||||
// This work is licensed under the terms of the MIT license.
|
// This work is licensed under the terms of the MIT license.
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2020 Computer Vision Center (CVC) at the Universitat Autonoma
|
// Copyright (c) 2023 Computer Vision Center (CVC) at the Universitat Autonoma
|
||||||
// de Barcelona (UAB).
|
// de Barcelona (UAB).
|
||||||
//
|
//
|
||||||
// This work is licensed under the terms of the MIT license.
|
// This work is licensed under the terms of the MIT license.
|
||||||
|
@ -216,7 +216,7 @@ bool LightManager::IsActive(LightId id) const {
|
||||||
}
|
}
|
||||||
|
|
||||||
void LightManager::SetActive(LightId id, bool active) {
|
void LightManager::SetActive(LightId id, bool active) {
|
||||||
std::lock_guard<std::mutex> lock(_mutex);
|
std::scoped_lock<std::mutex> lock(_mutex);
|
||||||
LightState& state = const_cast<LightState&>(RetrieveLightState(id));
|
LightState& state = const_cast<LightState&>(RetrieveLightState(id));
|
||||||
state._active = active;
|
state._active = active;
|
||||||
_lights_changes[id] = state;
|
_lights_changes[id] = state;
|
||||||
|
@ -224,7 +224,7 @@ void LightManager::SetActive(LightId id, bool active) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void LightManager::SetColor(LightId id, Color color) {
|
void LightManager::SetColor(LightId id, Color color) {
|
||||||
std::lock_guard<std::mutex> lock(_mutex);
|
std::scoped_lock<std::mutex> lock(_mutex);
|
||||||
LightState& state = const_cast<LightState&>(RetrieveLightState(id));
|
LightState& state = const_cast<LightState&>(RetrieveLightState(id));
|
||||||
state._color = color;
|
state._color = color;
|
||||||
_lights_changes[id] = state;
|
_lights_changes[id] = state;
|
||||||
|
@ -232,7 +232,7 @@ void LightManager::SetColor(LightId id, Color color) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void LightManager::SetIntensity(LightId id, float intensity) {
|
void LightManager::SetIntensity(LightId id, float intensity) {
|
||||||
std::lock_guard<std::mutex> lock(_mutex);
|
std::scoped_lock<std::mutex> lock(_mutex);
|
||||||
LightState& state = const_cast<LightState&>(RetrieveLightState(id));
|
LightState& state = const_cast<LightState&>(RetrieveLightState(id));
|
||||||
state._intensity = intensity;
|
state._intensity = intensity;
|
||||||
_lights_changes[id] = state;
|
_lights_changes[id] = state;
|
||||||
|
@ -240,7 +240,7 @@ void LightManager::SetIntensity(LightId id, float intensity) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void LightManager::SetLightState(LightId id, const LightState& new_state) {
|
void LightManager::SetLightState(LightId id, const LightState& new_state) {
|
||||||
std::lock_guard<std::mutex> lock(_mutex);
|
std::scoped_lock<std::mutex> lock(_mutex);
|
||||||
LightState& state = const_cast<LightState&>(RetrieveLightState(id));
|
LightState& state = const_cast<LightState&>(RetrieveLightState(id));
|
||||||
state = new_state;
|
state = new_state;
|
||||||
_lights_changes[id] = state;
|
_lights_changes[id] = state;
|
||||||
|
@ -254,7 +254,7 @@ void LightManager::SetLightStateNoLock(LightId id, const LightState& new_state)
|
||||||
}
|
}
|
||||||
|
|
||||||
void LightManager::SetLightGroup(LightId id, LightGroup group) {
|
void LightManager::SetLightGroup(LightId id, LightGroup group) {
|
||||||
std::lock_guard<std::mutex> lock(_mutex);
|
std::scoped_lock<std::mutex> lock(_mutex);
|
||||||
LightState& state = const_cast<LightState&>(RetrieveLightState(id));
|
LightState& state = const_cast<LightState&>(RetrieveLightState(id));
|
||||||
state._group = group;
|
state._group = group;
|
||||||
_lights_changes[id] = state;
|
_lights_changes[id] = state;
|
||||||
|
@ -271,7 +271,7 @@ const LightState& LightManager::RetrieveLightState(LightId id) const {
|
||||||
}
|
}
|
||||||
|
|
||||||
void LightManager::QueryLightsStateToServer() {
|
void LightManager::QueryLightsStateToServer() {
|
||||||
std::lock_guard<std::mutex> lock(_mutex);
|
std::scoped_lock<std::mutex> lock(_mutex);
|
||||||
// Send blocking query
|
// Send blocking query
|
||||||
std::vector<rpc::LightState> lights_snapshot = _episode.Lock()->QueryLightsStateToServer();
|
std::vector<rpc::LightState> lights_snapshot = _episode.Lock()->QueryLightsStateToServer();
|
||||||
|
|
||||||
|
@ -294,7 +294,7 @@ void LightManager::QueryLightsStateToServer() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void LightManager::UpdateServerLightsState(bool discard_client) {
|
void LightManager::UpdateServerLightsState(bool discard_client) {
|
||||||
std::lock_guard<std::mutex> lock(_mutex);
|
std::scoped_lock<std::mutex> lock(_mutex);
|
||||||
|
|
||||||
if(_dirty) {
|
if(_dirty) {
|
||||||
std::vector<rpc::LightState> message;
|
std::vector<rpc::LightState> message;
|
||||||
|
@ -321,7 +321,7 @@ void LightManager::UpdateServerLightsState(bool discard_client) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void LightManager::ApplyChanges() {
|
void LightManager::ApplyChanges() {
|
||||||
std::lock_guard<std::mutex> lock(_mutex);
|
std::scoped_lock<std::mutex> lock(_mutex);
|
||||||
for(const auto& it : _lights_changes) {
|
for(const auto& it : _lights_changes) {
|
||||||
SetLightStateNoLock(it.first, it.second);
|
SetLightStateNoLock(it.first, it.second);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2020 Computer Vision Center (CVC) at the Universitat Autonoma
|
// Copyright (c) 2023 Computer Vision Center (CVC) at the Universitat Autonoma
|
||||||
// de Barcelona (UAB).
|
// de Barcelona (UAB).
|
||||||
//
|
//
|
||||||
// This work is licensed under the terms of the MIT license.
|
// This work is licensed under the terms of the MIT license.
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2020 Computer Vision Center (CVC) at the Universitat Autonoma
|
// Copyright (c) 2023 Computer Vision Center (CVC) at the Universitat Autonoma
|
||||||
// de Barcelona (UAB).
|
// de Barcelona (UAB).
|
||||||
//
|
//
|
||||||
// This work is licensed under the terms of the MIT license.
|
// This work is licensed under the terms of the MIT license.
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2017 Computer Vision Center (CVC) at the Universitat Autonoma
|
// Copyright (c) 2023 Computer Vision Center (CVC) at the Universitat Autonoma
|
||||||
// de Barcelona (UAB).
|
// de Barcelona (UAB).
|
||||||
//
|
//
|
||||||
// This work is licensed under the terms of the MIT license.
|
// This work is licensed under the terms of the MIT license.
|
||||||
|
@ -45,7 +45,7 @@ namespace client {
|
||||||
const geom::Location &location,
|
const geom::Location &location,
|
||||||
bool project_to_road,
|
bool project_to_road,
|
||||||
int32_t lane_type) const {
|
int32_t lane_type) const {
|
||||||
boost::optional<road::element::Waypoint> waypoint;
|
std::optional<road::element::Waypoint> waypoint;
|
||||||
if (project_to_road) {
|
if (project_to_road) {
|
||||||
waypoint = _map.GetClosestWaypointOnRoad(location, lane_type);
|
waypoint = _map.GetClosestWaypointOnRoad(location, lane_type);
|
||||||
} else {
|
} else {
|
||||||
|
@ -60,7 +60,7 @@ namespace client {
|
||||||
carla::road::RoadId road_id,
|
carla::road::RoadId road_id,
|
||||||
carla::road::LaneId lane_id,
|
carla::road::LaneId lane_id,
|
||||||
float s) const {
|
float s) const {
|
||||||
boost::optional<road::element::Waypoint> waypoint;
|
std::optional<road::element::Waypoint> waypoint;
|
||||||
waypoint = _map.GetWaypoint(road_id, lane_id, s);
|
waypoint = _map.GetWaypoint(road_id, lane_id, s);
|
||||||
return waypoint.has_value() ?
|
return waypoint.has_value() ?
|
||||||
SharedPtr<Waypoint>(new Waypoint{shared_from_this(), *waypoint}) :
|
SharedPtr<Waypoint>(new Waypoint{shared_from_this(), *waypoint}) :
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2017 Computer Vision Center (CVC) at the Universitat Autonoma
|
// Copyright (c) 2023 Computer Vision Center (CVC) at the Universitat Autonoma
|
||||||
// de Barcelona (UAB).
|
// de Barcelona (UAB).
|
||||||
//
|
//
|
||||||
// This work is licensed under the terms of the MIT license.
|
// This work is licensed under the terms of the MIT license.
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2017 Computer Vision Center (CVC) at the Universitat Autonoma
|
// Copyright (c) 2023 Computer Vision Center (CVC) at the Universitat Autonoma
|
||||||
// de Barcelona (UAB).
|
// de Barcelona (UAB).
|
||||||
//
|
//
|
||||||
// This work is licensed under the terms of the MIT license.
|
// This work is licensed under the terms of the MIT license.
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2017 Computer Vision Center (CVC) at the Universitat Autonoma
|
// Copyright (c) 2023 Computer Vision Center (CVC) at the Universitat Autonoma
|
||||||
// de Barcelona (UAB).
|
// de Barcelona (UAB).
|
||||||
//
|
//
|
||||||
// This work is licensed under the terms of the MIT license.
|
// This work is licensed under the terms of the MIT license.
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2017 Computer Vision Center (CVC) at the Universitat Autonoma
|
// Copyright (c) 2023 Computer Vision Center (CVC) at the Universitat Autonoma
|
||||||
// de Barcelona (UAB).
|
// de Barcelona (UAB).
|
||||||
//
|
//
|
||||||
// This work is licensed under the terms of the MIT license.
|
// This work is licensed under the terms of the MIT license.
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2017 Computer Vision Center (CVC) at the Universitat Autonoma
|
// Copyright (c) 2023 Computer Vision Center (CVC) at the Universitat Autonoma
|
||||||
// de Barcelona (UAB).
|
// de Barcelona (UAB).
|
||||||
//
|
//
|
||||||
// This work is licensed under the terms of the MIT license.
|
// This work is licensed under the terms of the MIT license.
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2017 Computer Vision Center (CVC) at the Universitat Autonoma
|
// Copyright (c) 2023 Computer Vision Center (CVC) at the Universitat Autonoma
|
||||||
// de Barcelona (UAB).
|
// de Barcelona (UAB).
|
||||||
//
|
//
|
||||||
// This work is licensed under the terms of the MIT license.
|
// This work is licensed under the terms of the MIT license.
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2017 Computer Vision Center (CVC) at the Universitat Autonoma
|
// Copyright (c) 2023 Computer Vision Center (CVC) at the Universitat Autonoma
|
||||||
// de Barcelona (UAB).
|
// de Barcelona (UAB).
|
||||||
//
|
//
|
||||||
// This work is licensed under the terms of the MIT license.
|
// This work is licensed under the terms of the MIT license.
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2017 Computer Vision Center (CVC) at the Universitat Autonoma
|
// Copyright (c) 2023 Computer Vision Center (CVC) at the Universitat Autonoma
|
||||||
// de Barcelona (UAB).
|
// de Barcelona (UAB).
|
||||||
//
|
//
|
||||||
// This work is licensed under the terms of the MIT license.
|
// This work is licensed under the terms of the MIT license.
|
||||||
|
@ -69,7 +69,7 @@ namespace client {
|
||||||
auto ids = GetEpisode().Lock()->GetGroupTrafficLights(*this);
|
auto ids = GetEpisode().Lock()->GetGroupTrafficLights(*this);
|
||||||
for (auto id : ids) {
|
for (auto id : ids) {
|
||||||
SharedPtr<Actor> actor = GetWorld().GetActors()->Find(id);
|
SharedPtr<Actor> actor = GetWorld().GetActors()->Find(id);
|
||||||
result.push_back(boost::static_pointer_cast<TrafficLight>(actor));
|
result.push_back(std::static_pointer_cast<TrafficLight>(actor));
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2017 Computer Vision Center (CVC) at the Universitat Autonoma
|
// Copyright (c) 2023 Computer Vision Center (CVC) at the Universitat Autonoma
|
||||||
// de Barcelona (UAB).
|
// de Barcelona (UAB).
|
||||||
//
|
//
|
||||||
// This work is licensed under the terms of the MIT license.
|
// This work is licensed under the terms of the MIT license.
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2017 Computer Vision Center (CVC) at the Universitat Autonoma
|
// Copyright (c) 2023 Computer Vision Center (CVC) at the Universitat Autonoma
|
||||||
// de Barcelona (UAB).
|
// de Barcelona (UAB).
|
||||||
//
|
//
|
||||||
// This work is licensed under the terms of the MIT license.
|
// This work is licensed under the terms of the MIT license.
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2017 Computer Vision Center (CVC) at the Universitat Autonoma
|
// Copyright (c) 2023 Computer Vision Center (CVC) at the Universitat Autonoma
|
||||||
// de Barcelona (UAB).
|
// de Barcelona (UAB).
|
||||||
//
|
//
|
||||||
// This work is licensed under the terms of the MIT license.
|
// This work is licensed under the terms of the MIT license.
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2019 Computer Vision Center (CVC) at the Universitat Autonoma
|
// Copyright (c) 2023 Computer Vision Center (CVC) at the Universitat Autonoma
|
||||||
// de Barcelona (UAB).
|
// de Barcelona (UAB).
|
||||||
//
|
//
|
||||||
// This work is licensed under the terms of the MIT license.
|
// This work is licensed under the terms of the MIT license.
|
||||||
|
@ -117,7 +117,7 @@ namespace client {
|
||||||
|
|
||||||
SharedPtr<TrafficLight> Vehicle::GetTrafficLight() const {
|
SharedPtr<TrafficLight> Vehicle::GetTrafficLight() const {
|
||||||
auto id = GetEpisode().Lock()->GetActorSnapshot(*this).state.vehicle_data.traffic_light_id;
|
auto id = GetEpisode().Lock()->GetActorSnapshot(*this).state.vehicle_data.traffic_light_id;
|
||||||
return boost::static_pointer_cast<TrafficLight>(GetWorld().GetActor(id));
|
return std::static_pointer_cast<TrafficLight>(GetWorld().GetActor(id));
|
||||||
}
|
}
|
||||||
|
|
||||||
void Vehicle::EnableCarSim(std::string simfile_path) {
|
void Vehicle::EnableCarSim(std::string simfile_path) {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2019 Computer Vision Center (CVC) at the Universitat Autonoma
|
// Copyright (c) 2023 Computer Vision Center (CVC) at the Universitat Autonoma
|
||||||
// de Barcelona (UAB).
|
// de Barcelona (UAB).
|
||||||
//
|
//
|
||||||
// This work is licensed under the terms of the MIT license.
|
// This work is licensed under the terms of the MIT license.
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2017 Computer Vision Center (CVC) at the Universitat Autonoma
|
// Copyright (c) 2023 Computer Vision Center (CVC) at the Universitat Autonoma
|
||||||
// de Barcelona (UAB).
|
// de Barcelona (UAB).
|
||||||
//
|
//
|
||||||
// This work is licensed under the terms of the MIT license.
|
// This work is licensed under the terms of the MIT license.
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2017 Computer Vision Center (CVC) at the Universitat Autonoma
|
// Copyright (c) 2023 Computer Vision Center (CVC) at the Universitat Autonoma
|
||||||
// de Barcelona (UAB).
|
// de Barcelona (UAB).
|
||||||
//
|
//
|
||||||
// This work is licensed under the terms of the MIT license.
|
// This work is licensed under the terms of the MIT license.
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2019 Computer Vision Center (CVC) at the Universitat Autonoma
|
// Copyright (c) 2023 Computer Vision Center (CVC) at the Universitat Autonoma
|
||||||
// de Barcelona (UAB).
|
// de Barcelona (UAB).
|
||||||
//
|
//
|
||||||
// This work is licensed under the terms of the MIT license.
|
// This work is licensed under the terms of the MIT license.
|
||||||
|
@ -44,7 +44,7 @@ namespace client {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
boost::optional<geom::Location> WalkerAIController::GetRandomLocation() {
|
std::optional<geom::Location> WalkerAIController::GetRandomLocation() {
|
||||||
auto nav = GetEpisode().Lock()->GetNavigation();
|
auto nav = GetEpisode().Lock()->GetNavigation();
|
||||||
if (nav != nullptr) {
|
if (nav != nullptr) {
|
||||||
return nav->GetRandomLocation();
|
return nav->GetRandomLocation();
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2019 Computer Vision Center (CVC) at the Universitat Autonoma
|
// Copyright (c) 2023 Computer Vision Center (CVC) at the Universitat Autonoma
|
||||||
// de Barcelona (UAB).
|
// de Barcelona (UAB).
|
||||||
//
|
//
|
||||||
// This work is licensed under the terms of the MIT license.
|
// This work is licensed under the terms of the MIT license.
|
||||||
|
@ -9,7 +9,7 @@
|
||||||
#include "carla/client/Actor.h"
|
#include "carla/client/Actor.h"
|
||||||
#include "carla/geom/Vector3D.h"
|
#include "carla/geom/Vector3D.h"
|
||||||
|
|
||||||
#include <boost/optional.hpp>
|
#include <optional>
|
||||||
|
|
||||||
namespace carla {
|
namespace carla {
|
||||||
namespace client {
|
namespace client {
|
||||||
|
@ -23,7 +23,7 @@ namespace client {
|
||||||
|
|
||||||
void Stop();
|
void Stop();
|
||||||
|
|
||||||
boost::optional<geom::Location> GetRandomLocation();
|
std::optional<geom::Location> GetRandomLocation();
|
||||||
|
|
||||||
void GoToLocation(const carla::geom::Location &destination);
|
void GoToLocation(const carla::geom::Location &destination);
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2017 Computer Vision Center (CVC) at the Universitat Autonoma
|
// Copyright (c) 2023 Computer Vision Center (CVC) at the Universitat Autonoma
|
||||||
// de Barcelona (UAB).
|
// de Barcelona (UAB).
|
||||||
//
|
//
|
||||||
// This work is licensed under the terms of the MIT license.
|
// This work is licensed under the terms of the MIT license.
|
||||||
|
@ -145,18 +145,18 @@ namespace client {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
boost::optional<road::element::LaneMarking> Waypoint::GetRightLaneMarking() const {
|
std::optional<road::element::LaneMarking> Waypoint::GetRightLaneMarking() const {
|
||||||
if (_mark_record.first != nullptr) {
|
if (_mark_record.first != nullptr) {
|
||||||
return road::element::LaneMarking(*_mark_record.first);
|
return road::element::LaneMarking(*_mark_record.first);
|
||||||
}
|
}
|
||||||
return boost::optional<road::element::LaneMarking>{};
|
return std::optional<road::element::LaneMarking>{};
|
||||||
}
|
}
|
||||||
|
|
||||||
boost::optional<road::element::LaneMarking> Waypoint::GetLeftLaneMarking() const {
|
std::optional<road::element::LaneMarking> Waypoint::GetLeftLaneMarking() const {
|
||||||
if (_mark_record.second != nullptr) {
|
if (_mark_record.second != nullptr) {
|
||||||
return road::element::LaneMarking(*_mark_record.second);
|
return road::element::LaneMarking(*_mark_record.second);
|
||||||
}
|
}
|
||||||
return boost::optional<road::element::LaneMarking>{};
|
return std::optional<road::element::LaneMarking>{};
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename EnumT>
|
template <typename EnumT>
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2017 Computer Vision Center (CVC) at the Universitat Autonoma
|
// Copyright (c) 2023 Computer Vision Center (CVC) at the Universitat Autonoma
|
||||||
// de Barcelona (UAB).
|
// de Barcelona (UAB).
|
||||||
//
|
//
|
||||||
// This work is licensed under the terms of the MIT license.
|
// This work is licensed under the terms of the MIT license.
|
||||||
|
@ -15,7 +15,7 @@
|
||||||
#include "carla/road/Lane.h"
|
#include "carla/road/Lane.h"
|
||||||
#include "carla/road/RoadTypes.h"
|
#include "carla/road/RoadTypes.h"
|
||||||
|
|
||||||
#include <boost/optional.hpp>
|
#include <optional>
|
||||||
|
|
||||||
namespace carla {
|
namespace carla {
|
||||||
namespace client {
|
namespace client {
|
||||||
|
@ -85,9 +85,9 @@ namespace client {
|
||||||
|
|
||||||
SharedPtr<Waypoint> GetLeft() const;
|
SharedPtr<Waypoint> GetLeft() const;
|
||||||
|
|
||||||
boost::optional<road::element::LaneMarking> GetRightLaneMarking() const;
|
std::optional<road::element::LaneMarking> GetRightLaneMarking() const;
|
||||||
|
|
||||||
boost::optional<road::element::LaneMarking> GetLeftLaneMarking() const;
|
std::optional<road::element::LaneMarking> GetLeftLaneMarking() const;
|
||||||
|
|
||||||
road::element::LaneMarking::LaneChange GetLaneChange() const;
|
road::element::LaneMarking::LaneChange GetLaneChange() const;
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2017 Computer Vision Center (CVC) at the Universitat Autonoma
|
// Copyright (c) 2023 Computer Vision Center (CVC) at the Universitat Autonoma
|
||||||
// de Barcelona (UAB).
|
// de Barcelona (UAB).
|
||||||
//
|
//
|
||||||
// This work is licensed under the terms of the MIT license.
|
// This work is licensed under the terms of the MIT license.
|
||||||
|
@ -41,7 +41,7 @@ namespace client {
|
||||||
return _episode.Lock()->GetVehiclesLightStates();
|
return _episode.Lock()->GetVehiclesLightStates();
|
||||||
}
|
}
|
||||||
|
|
||||||
boost::optional<geom::Location> World::GetRandomLocationFromNavigation() const {
|
std::optional<geom::Location> World::GetRandomLocationFromNavigation() const {
|
||||||
return _episode.Lock()->GetRandomLocationFromNavigation();
|
return _episode.Lock()->GetRandomLocationFromNavigation();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -68,7 +68,7 @@ namespace client {
|
||||||
for (auto i = 0u; i < number_of_attemps; i++) {
|
for (auto i = 0u; i < number_of_attemps; i++) {
|
||||||
const auto curr_snapshot = GetSnapshot();
|
const auto curr_snapshot = GetSnapshot();
|
||||||
|
|
||||||
const double error = abs(new_settings.fixed_delta_seconds.get() - curr_snapshot.GetTimestamp().delta_seconds);
|
const double error = abs(new_settings.fixed_delta_seconds.value() - curr_snapshot.GetTimestamp().delta_seconds);
|
||||||
if (error < std::numeric_limits<float>::epsilon())
|
if (error < std::numeric_limits<float>::epsilon())
|
||||||
tics_correct++;
|
tics_correct++;
|
||||||
|
|
||||||
|
@ -237,7 +237,7 @@ namespace client {
|
||||||
_episode.Lock()->EnableEnvironmentObjects(env_objects_ids, enable);
|
_episode.Lock()->EnableEnvironmentObjects(env_objects_ids, enable);
|
||||||
}
|
}
|
||||||
|
|
||||||
boost::optional<rpc::LabelledPoint> World::ProjectPoint(
|
std::optional<rpc::LabelledPoint> World::ProjectPoint(
|
||||||
geom::Location location, geom::Vector3D direction, float search_distance) const {
|
geom::Location location, geom::Vector3D direction, float search_distance) const {
|
||||||
auto result = _episode.Lock()->ProjectPoint(location, direction, search_distance);
|
auto result = _episode.Lock()->ProjectPoint(location, direction, search_distance);
|
||||||
if (result.first) {
|
if (result.first) {
|
||||||
|
@ -246,7 +246,7 @@ namespace client {
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
boost::optional<rpc::LabelledPoint> World::GroundProjection(
|
std::optional<rpc::LabelledPoint> World::GroundProjection(
|
||||||
geom::Location location, float search_distance) const {
|
geom::Location location, float search_distance) const {
|
||||||
const geom::Vector3D DownVector(0,0,-1);
|
const geom::Vector3D DownVector(0,0,-1);
|
||||||
return ProjectPoint(location, DownVector, search_distance);
|
return ProjectPoint(location, DownVector, search_distance);
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2017 Computer Vision Center (CVC) at the Universitat Autonoma
|
// Copyright (c) 2023 Computer Vision Center (CVC) at the Universitat Autonoma
|
||||||
// de Barcelona (UAB).
|
// de Barcelona (UAB).
|
||||||
//
|
//
|
||||||
// This work is licensed under the terms of the MIT license.
|
// This work is licensed under the terms of the MIT license.
|
||||||
|
@ -29,7 +29,7 @@
|
||||||
#include "carla/rpc/Texture.h"
|
#include "carla/rpc/Texture.h"
|
||||||
#include "carla/rpc/MaterialParameter.h"
|
#include "carla/rpc/MaterialParameter.h"
|
||||||
|
|
||||||
#include <boost/optional.hpp>
|
#include <optional>
|
||||||
|
|
||||||
namespace carla {
|
namespace carla {
|
||||||
namespace client {
|
namespace client {
|
||||||
|
@ -76,7 +76,7 @@ namespace client {
|
||||||
rpc::VehicleLightStateList GetVehiclesLightStates() const;
|
rpc::VehicleLightStateList GetVehiclesLightStates() const;
|
||||||
|
|
||||||
/// Get a random location from the pedestrians navigation mesh
|
/// Get a random location from the pedestrians navigation mesh
|
||||||
boost::optional<geom::Location> GetRandomLocationFromNavigation() const;
|
std::optional<geom::Location> GetRandomLocationFromNavigation() const;
|
||||||
|
|
||||||
/// Return the spectator actor. The spectator controls the view in the
|
/// Return the spectator actor. The spectator controls the view in the
|
||||||
/// simulator window.
|
/// simulator window.
|
||||||
|
@ -177,10 +177,10 @@ namespace client {
|
||||||
std::vector<uint64_t> env_objects_ids,
|
std::vector<uint64_t> env_objects_ids,
|
||||||
bool enable) const;
|
bool enable) const;
|
||||||
|
|
||||||
boost::optional<rpc::LabelledPoint> ProjectPoint(
|
std::optional<rpc::LabelledPoint> ProjectPoint(
|
||||||
geom::Location location, geom::Vector3D direction, float search_distance = 10000.f) const;
|
geom::Location location, geom::Vector3D direction, float search_distance = 10000.f) const;
|
||||||
|
|
||||||
boost::optional<rpc::LabelledPoint> GroundProjection(
|
std::optional<rpc::LabelledPoint> GroundProjection(
|
||||||
geom::Location location, float search_distance = 10000.0) const;
|
geom::Location location, float search_distance = 10000.0) const;
|
||||||
|
|
||||||
std::vector<rpc::LabelledPoint> CastRay(
|
std::vector<rpc::LabelledPoint> CastRay(
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2019 Computer Vision Center (CVC) at the Universitat Autonoma
|
// Copyright (c) 2023 Computer Vision Center (CVC) at the Universitat Autonoma
|
||||||
// de Barcelona (UAB).
|
// de Barcelona (UAB).
|
||||||
//
|
//
|
||||||
// This work is licensed under the terms of the MIT license.
|
// This work is licensed under the terms of the MIT license.
|
||||||
|
@ -10,7 +10,7 @@
|
||||||
#include "carla/client/ActorSnapshot.h"
|
#include "carla/client/ActorSnapshot.h"
|
||||||
#include "carla/client/detail/EpisodeState.h"
|
#include "carla/client/detail/EpisodeState.h"
|
||||||
|
|
||||||
#include <boost/optional.hpp>
|
#include <optional>
|
||||||
|
|
||||||
namespace carla {
|
namespace carla {
|
||||||
namespace client {
|
namespace client {
|
||||||
|
@ -41,7 +41,7 @@ namespace client {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Find an ActorSnapshot by id.
|
/// Find an ActorSnapshot by id.
|
||||||
boost::optional<ActorSnapshot> Find(ActorId actor_id) const {
|
std::optional<ActorSnapshot> Find(ActorId actor_id) const {
|
||||||
return _state->GetActorSnapshotIfPresent(actor_id);
|
return _state->GetActorSnapshotIfPresent(actor_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2017 Computer Vision Center (CVC) at the Universitat Autonoma
|
// Copyright (c) 2023 Computer Vision Center (CVC) at the Universitat Autonoma
|
||||||
// de Barcelona (UAB).
|
// de Barcelona (UAB).
|
||||||
//
|
//
|
||||||
// This work is licensed under the terms of the MIT license.
|
// This work is licensed under the terms of the MIT license.
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2017 Computer Vision Center (CVC) at the Universitat Autonoma
|
// Copyright (c) 2023 Computer Vision Center (CVC) at the Universitat Autonoma
|
||||||
// de Barcelona (UAB).
|
// de Barcelona (UAB).
|
||||||
//
|
//
|
||||||
// This work is licensed under the terms of the MIT license.
|
// This work is licensed under the terms of the MIT license.
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2017 Computer Vision Center (CVC) at the Universitat Autonoma
|
// Copyright (c) 2023 Computer Vision Center (CVC) at the Universitat Autonoma
|
||||||
// de Barcelona (UAB).
|
// de Barcelona (UAB).
|
||||||
//
|
//
|
||||||
// This work is licensed under the terms of the MIT license.
|
// This work is licensed under the terms of the MIT license.
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2017 Computer Vision Center (CVC) at the Universitat Autonoma
|
// Copyright (c) 2023 Computer Vision Center (CVC) at the Universitat Autonoma
|
||||||
// de Barcelona (UAB).
|
// de Barcelona (UAB).
|
||||||
//
|
//
|
||||||
// This work is licensed under the terms of the MIT license.
|
// This work is licensed under the terms of the MIT license.
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2017 Computer Vision Center (CVC) at the Universitat Autonoma
|
// Copyright (c) 2023 Computer Vision Center (CVC) at the Universitat Autonoma
|
||||||
// de Barcelona (UAB).
|
// de Barcelona (UAB).
|
||||||
//
|
//
|
||||||
// This work is licensed under the terms of the MIT license.
|
// This work is licensed under the terms of the MIT license.
|
||||||
|
@ -16,7 +16,7 @@ namespace detail {
|
||||||
void ActorVariant::MakeActor(EpisodeProxy episode) const {
|
void ActorVariant::MakeActor(EpisodeProxy episode) const {
|
||||||
_value = detail::ActorFactory::MakeActor(
|
_value = detail::ActorFactory::MakeActor(
|
||||||
episode,
|
episode,
|
||||||
boost::variant2::get<rpc::Actor>(std::move(_value)),
|
std::get<rpc::Actor>(std::move(_value)),
|
||||||
GarbageCollectionPolicy::Disabled);
|
GarbageCollectionPolicy::Disabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2017 Computer Vision Center (CVC) at the Universitat Autonoma
|
// Copyright (c) 2023 Computer Vision Center (CVC) at the Universitat Autonoma
|
||||||
// de Barcelona (UAB).
|
// de Barcelona (UAB).
|
||||||
//
|
//
|
||||||
// This work is licensed under the terms of the MIT license.
|
// This work is licensed under the terms of the MIT license.
|
||||||
|
@ -16,10 +16,10 @@
|
||||||
#pragma warning(push)
|
#pragma warning(push)
|
||||||
#pragma warning(disable:4583)
|
#pragma warning(disable:4583)
|
||||||
#pragma warning(disable:4582)
|
#pragma warning(disable:4582)
|
||||||
#include <boost/variant2/variant.hpp>
|
#include <variant>
|
||||||
#pragma warning(pop)
|
#pragma warning(pop)
|
||||||
#else
|
#else
|
||||||
#include <boost/variant2/variant.hpp>
|
#include <variant>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
namespace carla {
|
namespace carla {
|
||||||
|
@ -51,11 +51,11 @@ namespace detail {
|
||||||
MakeActor(episode);
|
MakeActor(episode);
|
||||||
}
|
}
|
||||||
DEBUG_ASSERT(_value.index() == 1u);
|
DEBUG_ASSERT(_value.index() == 1u);
|
||||||
return boost::variant2::get<SharedPtr<client::Actor>>(_value);
|
return std::get<SharedPtr<client::Actor>>(_value);
|
||||||
}
|
}
|
||||||
|
|
||||||
const rpc::Actor &Serialize() const {
|
const rpc::Actor &Serialize() const {
|
||||||
return boost::variant2::visit(Visitor(), _value);
|
return std::visit(Visitor(), _value);
|
||||||
}
|
}
|
||||||
|
|
||||||
ActorId GetId() const {
|
ActorId GetId() const {
|
||||||
|
@ -91,7 +91,7 @@ namespace detail {
|
||||||
|
|
||||||
void MakeActor(EpisodeProxy episode) const;
|
void MakeActor(EpisodeProxy episode) const;
|
||||||
|
|
||||||
mutable boost::variant2::variant<rpc::Actor, SharedPtr<client::Actor>> _value;
|
mutable std::variant<rpc::Actor, SharedPtr<client::Actor>> _value;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace detail
|
} // namespace detail
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2017 Computer Vision Center (CVC) at the Universitat Autonoma
|
// Copyright (c) 2023 Computer Vision Center (CVC) at the Universitat Autonoma
|
||||||
// de Barcelona (UAB).
|
// de Barcelona (UAB).
|
||||||
//
|
//
|
||||||
// This work is licensed under the terms of the MIT license.
|
// This work is licensed under the terms of the MIT license.
|
||||||
|
@ -44,7 +44,7 @@ namespace detail {
|
||||||
|
|
||||||
/// Retrieve the actor matching @a id, or empty optional if actor is not
|
/// Retrieve the actor matching @a id, or empty optional if actor is not
|
||||||
/// cached.
|
/// cached.
|
||||||
boost::optional<rpc::Actor> GetActorById(ActorId id) const;
|
std::optional<rpc::Actor> GetActorById(ActorId id) const;
|
||||||
|
|
||||||
/// Retrieve the actors matching the ids in @a range.
|
/// Retrieve the actors matching the ids in @a range.
|
||||||
template <typename RangeT>
|
template <typename RangeT>
|
||||||
|
@ -64,7 +64,7 @@ namespace detail {
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
inline void CachedActorList::Insert(rpc::Actor actor) {
|
inline void CachedActorList::Insert(rpc::Actor actor) {
|
||||||
std::lock_guard<std::mutex> lock(_mutex);
|
std::scoped_lock<std::mutex> lock(_mutex);
|
||||||
auto id = actor.id;
|
auto id = actor.id;
|
||||||
_actors.emplace(id, std::move(actor));
|
_actors.emplace(id, std::move(actor));
|
||||||
}
|
}
|
||||||
|
@ -78,7 +78,7 @@ namespace detail {
|
||||||
auto make_iterator = [&make_a_pair](auto it) {
|
auto make_iterator = [&make_a_pair](auto it) {
|
||||||
return boost::make_transform_iterator(std::make_move_iterator(it), make_a_pair);
|
return boost::make_transform_iterator(std::make_move_iterator(it), make_a_pair);
|
||||||
};
|
};
|
||||||
std::lock_guard<std::mutex> lock(_mutex);
|
std::scoped_lock<std::mutex> lock(_mutex);
|
||||||
_actors.insert(make_iterator(std::begin(range)), make_iterator(std::end(range)));
|
_actors.insert(make_iterator(std::begin(range)), make_iterator(std::end(range)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -86,27 +86,27 @@ namespace detail {
|
||||||
inline std::vector<ActorId> CachedActorList::GetMissingIds(const RangeT &range) const {
|
inline std::vector<ActorId> CachedActorList::GetMissingIds(const RangeT &range) const {
|
||||||
std::vector<ActorId> result;
|
std::vector<ActorId> result;
|
||||||
result.reserve(range.size());
|
result.reserve(range.size());
|
||||||
std::lock_guard<std::mutex> lock(_mutex);
|
std::scoped_lock<std::mutex> lock(_mutex);
|
||||||
std::copy_if(std::begin(range), std::end(range), std::back_inserter(result), [this](auto id) {
|
std::copy_if(std::begin(range), std::end(range), std::back_inserter(result), [this](auto id) {
|
||||||
return _actors.find(id) == _actors.end();
|
return _actors.find(id) == _actors.end();
|
||||||
});
|
});
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline boost::optional<rpc::Actor> CachedActorList::GetActorById(ActorId id) const {
|
inline std::optional<rpc::Actor> CachedActorList::GetActorById(ActorId id) const {
|
||||||
std::lock_guard<std::mutex> lock(_mutex);
|
std::scoped_lock<std::mutex> lock(_mutex);
|
||||||
auto it = _actors.find(id);
|
auto it = _actors.find(id);
|
||||||
if (it != _actors.end()) {
|
if (it != _actors.end()) {
|
||||||
return it->second;
|
return it->second;
|
||||||
}
|
}
|
||||||
return boost::none;
|
return std::nullopt;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename RangeT>
|
template <typename RangeT>
|
||||||
inline std::vector<rpc::Actor> CachedActorList::GetActorsById(const RangeT &range) const {
|
inline std::vector<rpc::Actor> CachedActorList::GetActorsById(const RangeT &range) const {
|
||||||
std::vector<rpc::Actor> result;
|
std::vector<rpc::Actor> result;
|
||||||
result.reserve(range.size());
|
result.reserve(range.size());
|
||||||
std::lock_guard<std::mutex> lock(_mutex);
|
std::scoped_lock<std::mutex> lock(_mutex);
|
||||||
for (auto &&id : range) {
|
for (auto &&id : range) {
|
||||||
auto it = _actors.find(id);
|
auto it = _actors.find(id);
|
||||||
if (it != _actors.end()) {
|
if (it != _actors.end()) {
|
||||||
|
@ -117,7 +117,7 @@ namespace detail {
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void CachedActorList::Clear() {
|
inline void CachedActorList::Clear() {
|
||||||
std::lock_guard<std::mutex> lock(_mutex);
|
std::scoped_lock<std::mutex> lock(_mutex);
|
||||||
_actors.clear();
|
_actors.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2017 Computer Vision Center (CVC) at the Universitat Autonoma
|
// Copyright (c) 2023 Computer Vision Center (CVC) at the Universitat Autonoma
|
||||||
// de Barcelona (UAB).
|
// de Barcelona (UAB).
|
||||||
//
|
//
|
||||||
// This work is licensed under the terms of the MIT license.
|
// This work is licensed under the terms of the MIT license.
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2017 Computer Vision Center (CVC) at the Universitat Autonoma
|
// Copyright (c) 2023 Computer Vision Center (CVC) at the Universitat Autonoma
|
||||||
// de Barcelona (UAB).
|
// de Barcelona (UAB).
|
||||||
//
|
//
|
||||||
// This work is licensed under the terms of the MIT license.
|
// This work is licensed under the terms of the MIT license.
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2017 Computer Vision Center (CVC) at the Universitat Autonoma
|
// Copyright (c) 2023 Computer Vision Center (CVC) at the Universitat Autonoma
|
||||||
// de Barcelona (UAB).
|
// de Barcelona (UAB).
|
||||||
//
|
//
|
||||||
// This work is licensed under the terms of the MIT license.
|
// This work is licensed under the terms of the MIT license.
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2017 Computer Vision Center (CVC) at the Universitat Autonoma
|
// Copyright (c) 2023 Computer Vision Center (CVC) at the Universitat Autonoma
|
||||||
// de Barcelona (UAB).
|
// de Barcelona (UAB).
|
||||||
//
|
//
|
||||||
// This work is licensed under the terms of the MIT license.
|
// This work is licensed under the terms of the MIT license.
|
||||||
|
@ -110,7 +110,7 @@ using namespace std::chrono_literals;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
boost::optional<rpc::Actor> Episode::GetActorById(ActorId id) {
|
std::optional<rpc::Actor> Episode::GetActorById(ActorId id) {
|
||||||
auto actor = _actors.GetActorById(id);
|
auto actor = _actors.GetActorById(id);
|
||||||
if (!actor.has_value()) {
|
if (!actor.has_value()) {
|
||||||
auto actor_list = _client.GetActorsById({id});
|
auto actor_list = _client.GetActorsById({id});
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2017 Computer Vision Center (CVC) at the Universitat Autonoma
|
// Copyright (c) 2023 Computer Vision Center (CVC) at the Universitat Autonoma
|
||||||
// de Barcelona (UAB).
|
// de Barcelona (UAB).
|
||||||
//
|
//
|
||||||
// This work is licensed under the terms of the MIT license.
|
// This work is licensed under the terms of the MIT license.
|
||||||
|
@ -54,13 +54,13 @@ namespace detail {
|
||||||
_actors.Insert(std::move(actor));
|
_actors.Insert(std::move(actor));
|
||||||
}
|
}
|
||||||
|
|
||||||
boost::optional<rpc::Actor> GetActorById(ActorId id);
|
std::optional<rpc::Actor> GetActorById(ActorId id);
|
||||||
|
|
||||||
std::vector<rpc::Actor> GetActorsById(const std::vector<ActorId> &actor_ids);
|
std::vector<rpc::Actor> GetActorsById(const std::vector<ActorId> &actor_ids);
|
||||||
|
|
||||||
std::vector<rpc::Actor> GetActors();
|
std::vector<rpc::Actor> GetActors();
|
||||||
|
|
||||||
boost::optional<WorldSnapshot> WaitForState(time_duration timeout) {
|
std::optional<WorldSnapshot> WaitForState(time_duration timeout) {
|
||||||
return _snapshot.WaitFor(timeout);
|
return _snapshot.WaitFor(timeout);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2017 Computer Vision Center (CVC) at the Universitat Autonoma
|
// Copyright (c) 2023 Computer Vision Center (CVC) at the Universitat Autonoma
|
||||||
// de Barcelona (UAB).
|
// de Barcelona (UAB).
|
||||||
//
|
//
|
||||||
// This work is licensed under the terms of the MIT license.
|
// This work is licensed under the terms of the MIT license.
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2017 Computer Vision Center (CVC) at the Universitat Autonoma
|
// Copyright (c) 2023 Computer Vision Center (CVC) at the Universitat Autonoma
|
||||||
// de Barcelona (UAB).
|
// de Barcelona (UAB).
|
||||||
//
|
//
|
||||||
// This work is licensed under the terms of the MIT license.
|
// This work is licensed under the terms of the MIT license.
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2017 Computer Vision Center (CVC) at the Universitat Autonoma
|
// Copyright (c) 2023 Computer Vision Center (CVC) at the Universitat Autonoma
|
||||||
// de Barcelona (UAB).
|
// de Barcelona (UAB).
|
||||||
//
|
//
|
||||||
// This work is licensed under the terms of the MIT license.
|
// This work is licensed under the terms of the MIT license.
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2017 Computer Vision Center (CVC) at the Universitat Autonoma
|
// Copyright (c) 2023 Computer Vision Center (CVC) at the Universitat Autonoma
|
||||||
// de Barcelona (UAB).
|
// de Barcelona (UAB).
|
||||||
//
|
//
|
||||||
// This work is licensed under the terms of the MIT license.
|
// This work is licensed under the terms of the MIT license.
|
||||||
|
@ -14,7 +14,7 @@
|
||||||
#include "carla/geom/Vector3DInt.h"
|
#include "carla/geom/Vector3DInt.h"
|
||||||
#include "carla/sensor/data/RawEpisodeState.h"
|
#include "carla/sensor/data/RawEpisodeState.h"
|
||||||
|
|
||||||
#include <boost/optional.hpp>
|
#include <optional>
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <unordered_map>
|
#include <unordered_map>
|
||||||
|
@ -70,8 +70,8 @@ namespace detail {
|
||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
|
|
||||||
boost::optional<ActorSnapshot> GetActorSnapshotIfPresent(ActorId id) const {
|
std::optional<ActorSnapshot> GetActorSnapshotIfPresent(ActorId id) const {
|
||||||
boost::optional<ActorSnapshot> state;
|
std::optional<ActorSnapshot> state;
|
||||||
CopyActorSnapshotIfPresent(id, state);
|
CopyActorSnapshotIfPresent(id, state);
|
||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2017 Computer Vision Center (CVC) at the Universitat Autonoma
|
// Copyright (c) 2023 Computer Vision Center (CVC) at the Universitat Autonoma
|
||||||
// de Barcelona (UAB).
|
// de Barcelona (UAB).
|
||||||
//
|
//
|
||||||
// This work is licensed under the terms of the MIT license.
|
// This work is licensed under the terms of the MIT license.
|
||||||
|
@ -264,7 +264,7 @@ EpisodeProxy Simulator::GetCurrentEpisode() {
|
||||||
"synchronous mode and substepping are enabled but the number of substeps is not valid. "
|
"synchronous mode and substepping are enabled but the number of substeps is not valid. "
|
||||||
"Please be aware that this value needs to be in the range [1-16].");
|
"Please be aware that this value needs to be in the range [1-16].");
|
||||||
}
|
}
|
||||||
double n_substeps = settings.fixed_delta_seconds.get() / settings.max_substep_delta_time;
|
double n_substeps = settings.fixed_delta_seconds.value() / settings.max_substep_delta_time;
|
||||||
|
|
||||||
if (n_substeps > static_cast<double>(settings.max_substeps)) {
|
if (n_substeps > static_cast<double>(settings.max_substeps)) {
|
||||||
log_warning(
|
log_warning(
|
||||||
|
@ -320,7 +320,7 @@ EpisodeProxy Simulator::GetCurrentEpisode() {
|
||||||
nav->UnregisterWalker(walker->GetId(), controller.GetId());
|
nav->UnregisterWalker(walker->GetId(), controller.GetId());
|
||||||
}
|
}
|
||||||
|
|
||||||
boost::optional<geom::Location> Simulator::GetRandomLocationFromNavigation() {
|
std::optional<geom::Location> Simulator::GetRandomLocationFromNavigation() {
|
||||||
DEBUG_ASSERT(_episode != nullptr);
|
DEBUG_ASSERT(_episode != nullptr);
|
||||||
auto nav = _episode->CreateNavigationIfMissing();
|
auto nav = _episode->CreateNavigationIfMissing();
|
||||||
return nav->GetRandomLocation();
|
return nav->GetRandomLocation();
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue