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 (CheckCXXCompilerFlag)
|
||||
|
||||
set (CMAKE_CXX_STANDARD 17)
|
||||
set (CMAKE_CXX_STANDARD 20)
|
||||
set (CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
set (CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
||||
|
||||
|
|
|
@ -471,6 +471,12 @@ class DependencyUEPlugin(Dependency):
|
|||
super().__init__(name, *sources)
|
||||
|
||||
DEFAULT_DEPENDENCIES = [
|
||||
Dependency(
|
||||
'boost-asio',
|
||||
GitRepository('https://github.com/boostorg/asio.git')),
|
||||
Dependency(
|
||||
'boost-python',
|
||||
GitRepository('https://github.com/boostorg/python.git')),
|
||||
Dependency(
|
||||
'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'),
|
||||
|
|
|
@ -99,7 +99,7 @@ int main(int argc, const char *argv[]) {
|
|||
// Spawn the vehicle.
|
||||
auto actor = world.SpawnActor(blueprint, transform);
|
||||
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.
|
||||
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::Rotation{-15.0f, 0.0f, 0.0f}}; // pitch, yaw, roll.
|
||||
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.
|
||||
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);
|
||||
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).
|
||||
//
|
||||
// This work is licensed under the terms of the MIT license.
|
||||
|
@ -30,14 +30,14 @@ namespace detail {
|
|||
|
||||
template <typename ValueT>
|
||||
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());
|
||||
new_list->emplace_back(std::forward<ValueT>(value));
|
||||
_list = new_list;
|
||||
}
|
||||
|
||||
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 begin = new_list->begin();
|
||||
std::advance(begin, index);
|
||||
|
@ -47,14 +47,14 @@ namespace detail {
|
|||
|
||||
template <typename ValueT>
|
||||
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());
|
||||
new_list->erase(std::remove(new_list->begin(), new_list->end(), value), new_list->end());
|
||||
_list = new_list;
|
||||
}
|
||||
|
||||
void Clear() {
|
||||
std::lock_guard<std::mutex> lock(_mutex);
|
||||
std::scoped_lock<std::mutex> lock(_mutex);
|
||||
_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).
|
||||
//
|
||||
// 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).
|
||||
//
|
||||
// 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).
|
||||
//
|
||||
// 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).
|
||||
//
|
||||
// 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).
|
||||
//
|
||||
// This work is licensed under the terms of the MIT license.
|
||||
// For a copy, see <https://opensource.org/licenses/MIT>.
|
||||
|
||||
#include "carla/Exception.h"
|
||||
#include <boost/assert/source_location.hpp>
|
||||
#include <source_location>
|
||||
|
||||
// =============================================================================
|
||||
// -- Define boost::throw_exception --------------------------------------------
|
||||
|
@ -15,13 +15,15 @@
|
|||
|
||||
namespace boost {
|
||||
|
||||
void throw_exception(const std::exception &e) {
|
||||
void throw_exception(const std::exception &e)
|
||||
{
|
||||
carla::throw_exception(e);
|
||||
}
|
||||
|
||||
void throw_exception(
|
||||
const std::exception &e,
|
||||
boost::source_location const & loc) {
|
||||
std::source_location const& loc)
|
||||
{
|
||||
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).
|
||||
//
|
||||
// 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).
|
||||
//
|
||||
// This work is licensed under the terms of the MIT license.
|
||||
|
@ -9,11 +9,11 @@
|
|||
#include "carla/Exception.h"
|
||||
#include "carla/StringUtil.h"
|
||||
|
||||
#include <boost/filesystem/operations.hpp>
|
||||
#include <filesystem>
|
||||
|
||||
namespace carla {
|
||||
|
||||
namespace fs = boost::filesystem;
|
||||
namespace fs = std::filesystem;
|
||||
|
||||
void FileSystem::ValidateFilePath(std::string &filepath, const std::string &ext) {
|
||||
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).
|
||||
//
|
||||
// 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).
|
||||
//
|
||||
// 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).
|
||||
//
|
||||
// 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).
|
||||
//
|
||||
// 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).
|
||||
//
|
||||
// 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).
|
||||
//
|
||||
// This work is licensed under the terms of the MIT license.
|
||||
|
@ -6,28 +6,26 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <boost/enable_shared_from_this.hpp>
|
||||
#include <boost/make_shared.hpp>
|
||||
#include <boost/shared_ptr.hpp>
|
||||
#include <boost/weak_ptr.hpp>
|
||||
#include <memory>
|
||||
#include <utility>
|
||||
|
||||
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
|
||||
/// adaptor for std::shared_ptr.
|
||||
template <typename T>
|
||||
using SharedPtr = boost::shared_ptr<T>;
|
||||
using SharedPtr = std::shared_ptr<T>;
|
||||
|
||||
template <typename T>
|
||||
using WeakPtr = boost::weak_ptr<T>;
|
||||
using WeakPtr = std::weak_ptr<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>
|
||||
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
|
||||
|
|
|
@ -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).
|
||||
//
|
||||
// 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).
|
||||
//
|
||||
// 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).
|
||||
//
|
||||
// This work is licensed under the terms of the MIT license.
|
||||
|
@ -9,16 +9,16 @@
|
|||
#include "carla/Exception.h"
|
||||
#include "carla/MsgPack.h"
|
||||
|
||||
#include <boost/optional.hpp>
|
||||
#include <optional>
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable:4583)
|
||||
#pragma warning(disable:4582)
|
||||
#include <boost/variant2/variant.hpp>
|
||||
#include <variant>
|
||||
#pragma warning(pop)
|
||||
#else
|
||||
#include <boost/variant2/variant.hpp>
|
||||
#include <variant>
|
||||
#endif
|
||||
|
||||
#include <tuple>
|
||||
|
@ -28,21 +28,21 @@ MSGPACK_API_VERSION_NAMESPACE(MSGPACK_DEFAULT_API_NS) {
|
|||
namespace adaptor {
|
||||
|
||||
// ===========================================================================
|
||||
// -- Adaptors for boost::optional -------------------------------------------
|
||||
// -- Adaptors for std::optional -------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
template<typename T>
|
||||
struct convert<boost::optional<T>> {
|
||||
struct convert<std::optional<T>> {
|
||||
const clmdep_msgpack::object &operator()(
|
||||
const clmdep_msgpack::object &o,
|
||||
boost::optional<T> &v) const {
|
||||
std::optional<T> &v) const {
|
||||
if (o.type != clmdep_msgpack::type::ARRAY) {
|
||||
::carla::throw_exception(clmdep_msgpack::type_error());
|
||||
}
|
||||
if (o.via.array.size == 1) {
|
||||
v.reset();
|
||||
} 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 {
|
||||
::carla::throw_exception(clmdep_msgpack::type_error());
|
||||
}
|
||||
|
@ -51,11 +51,11 @@ namespace adaptor {
|
|||
};
|
||||
|
||||
template<typename T>
|
||||
struct pack<boost::optional<T>> {
|
||||
struct pack<std::optional<T>> {
|
||||
template <typename Stream>
|
||||
packer<Stream> &operator()(
|
||||
clmdep_msgpack::packer<Stream> &o,
|
||||
const boost::optional<T> &v) const {
|
||||
const std::optional<T> &v) const {
|
||||
if (v.has_value()) {
|
||||
o.pack_array(2);
|
||||
o.pack(true);
|
||||
|
@ -69,10 +69,10 @@ namespace adaptor {
|
|||
};
|
||||
|
||||
template<typename T>
|
||||
struct object_with_zone<boost::optional<T>> {
|
||||
struct object_with_zone<std::optional<T>> {
|
||||
void operator()(
|
||||
clmdep_msgpack::object::with_zone &o,
|
||||
const boost::optional<T> &v) const {
|
||||
const std::optional<T> &v) const {
|
||||
o.type = type::ARRAY;
|
||||
if (v.has_value()) {
|
||||
o.via.array.size = 2;
|
||||
|
@ -92,15 +92,15 @@ namespace adaptor {
|
|||
};
|
||||
|
||||
// ===========================================================================
|
||||
// -- Adaptors for boost::variant2::variant ----------------------------------
|
||||
// -- Adaptors for std::variant ----------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
template<typename... Ts>
|
||||
struct convert<boost::variant2::variant<Ts...>> {
|
||||
struct convert<std::variant<Ts...>> {
|
||||
|
||||
const clmdep_msgpack::object &operator()(
|
||||
const clmdep_msgpack::object &o,
|
||||
boost::variant2::variant<Ts...> &v) const {
|
||||
std::variant<Ts...> &v) const {
|
||||
if (o.type != clmdep_msgpack::type::ARRAY) {
|
||||
::carla::throw_exception(clmdep_msgpack::type_error());
|
||||
}
|
||||
|
@ -117,7 +117,7 @@ namespace adaptor {
|
|||
template <uint64_t I>
|
||||
static void copy_to_variant_impl(
|
||||
const clmdep_msgpack::object &o,
|
||||
boost::variant2::variant<Ts...> &v) {
|
||||
std::variant<Ts...> &v) {
|
||||
/// @todo Workaround for finding the type.
|
||||
auto dummy = std::get<I>(std::tuple<Ts...>{});
|
||||
using T = decltype(dummy);
|
||||
|
@ -128,7 +128,7 @@ namespace adaptor {
|
|||
static void copy_to_variant(
|
||||
const uint64_t index,
|
||||
const clmdep_msgpack::object &o,
|
||||
boost::variant2::variant<Ts...> &v,
|
||||
std::variant<Ts...> &v,
|
||||
std::index_sequence<Is...>) {
|
||||
std::initializer_list<int> ({
|
||||
(index == Is ? copy_to_variant_impl<Is>(o, v), 0 : 0)...
|
||||
|
@ -137,30 +137,30 @@ namespace adaptor {
|
|||
};
|
||||
|
||||
template<typename... Ts>
|
||||
struct pack<boost::variant2::variant<Ts...>> {
|
||||
struct pack<std::variant<Ts...>> {
|
||||
template <typename Stream>
|
||||
packer<Stream> &operator()(
|
||||
clmdep_msgpack::packer<Stream> &o,
|
||||
const boost::variant2::variant<Ts...> &v) const {
|
||||
const std::variant<Ts...> &v) const {
|
||||
o.pack_array(2);
|
||||
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;
|
||||
}
|
||||
};
|
||||
|
||||
template<typename... Ts>
|
||||
struct object_with_zone<boost::variant2::variant<Ts...>> {
|
||||
struct object_with_zone<std::variant<Ts...>> {
|
||||
void operator()(
|
||||
clmdep_msgpack::object::with_zone &o,
|
||||
const boost::variant2::variant<Ts...> &v) const {
|
||||
const std::variant<Ts...> &v) const {
|
||||
o.type = type::ARRAY;
|
||||
o.via.array.size = 2;
|
||||
o.via.array.ptr = static_cast<clmdep_msgpack::object*>(o.zone.allocate_align(
|
||||
sizeof(clmdep_msgpack::object) * o.via.array.size,
|
||||
MSGPACK_ZONE_ALIGNOF(clmdep_msgpack::object)));
|
||||
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);
|
||||
}, 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).
|
||||
//
|
||||
// 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).
|
||||
//
|
||||
// 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).
|
||||
//
|
||||
// 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).
|
||||
//
|
||||
// This work is licensed under the terms of the MIT license.
|
||||
|
@ -9,15 +9,15 @@
|
|||
#include "carla/Exception.h"
|
||||
#include "carla/Time.h"
|
||||
|
||||
#include <boost/optional.hpp>
|
||||
#include <optional>
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable:4583)
|
||||
#pragma warning(disable:4582)
|
||||
#include <boost/variant2/variant.hpp>
|
||||
#include <variant>
|
||||
#pragma warning(pop)
|
||||
#else
|
||||
#include <boost/variant2/variant.hpp>
|
||||
#include <variant>
|
||||
#endif
|
||||
|
||||
#include <condition_variable>
|
||||
|
@ -49,7 +49,7 @@ namespace detail {
|
|||
/// simultaneously.
|
||||
///
|
||||
/// @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.
|
||||
template <typename T2>
|
||||
|
@ -71,7 +71,7 @@ namespace detail {
|
|||
|
||||
struct mapped_type {
|
||||
bool should_wait;
|
||||
boost::variant2::variant<SharedException, T> value;
|
||||
std::variant<SharedException, T> value;
|
||||
};
|
||||
|
||||
std::map<const char *, mapped_type> _map;
|
||||
|
@ -110,7 +110,7 @@ namespace detail {
|
|||
} // namespace detail
|
||||
|
||||
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);
|
||||
auto &r = _map[&detail::thread_tag];
|
||||
r.should_wait = true;
|
||||
|
@ -118,15 +118,15 @@ namespace detail {
|
|||
return {};
|
||||
}
|
||||
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 T2>
|
||||
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) {
|
||||
pair.second.should_wait = false;
|
||||
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).
|
||||
//
|
||||
// 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).
|
||||
//
|
||||
// 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).
|
||||
//
|
||||
// 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).
|
||||
//
|
||||
// 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).
|
||||
//
|
||||
// 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).
|
||||
//
|
||||
// This work is licensed under the terms of the MIT license.
|
||||
|
@ -39,12 +39,7 @@ namespace carla {
|
|||
/// Post a task to the pool.
|
||||
template <
|
||||
typename FunctorT,
|
||||
#if __cplusplus < 201703L
|
||||
typename ResultT = typename std::result_of_t<FunctorT()>
|
||||
#else
|
||||
typename ResultT = typename std::invoke_result_t<FunctorT()>
|
||||
#endif
|
||||
>
|
||||
typename ResultT = typename std::invoke_result_t<FunctorT()>>
|
||||
std::future<ResultT> Post(FunctorT &&functor) {
|
||||
auto task = std::packaged_task<ResultT()>(std::forward<FunctorT>(functor));
|
||||
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).
|
||||
//
|
||||
// This work is licensed under the terms of the MIT license.
|
||||
|
@ -7,11 +7,12 @@
|
|||
#pragma once
|
||||
|
||||
#include "carla/Debug.h"
|
||||
|
||||
#include <boost/date_time/posix_time/posix_time_types.hpp>
|
||||
|
||||
#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 {
|
||||
|
||||
/// Positive time duration up to milliseconds resolution. Automatically casts
|
||||
|
@ -36,16 +37,19 @@ namespace carla {
|
|||
DEBUG_ASSERT(count >= 0);
|
||||
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 &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 {
|
||||
return boost::posix_time::milliseconds(_milliseconds);
|
||||
}
|
||||
#endif
|
||||
|
||||
constexpr auto to_chrono() const {
|
||||
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).
|
||||
//
|
||||
// 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).
|
||||
//
|
||||
// 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).
|
||||
//
|
||||
// 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).
|
||||
//
|
||||
// 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).
|
||||
//
|
||||
// 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).
|
||||
//
|
||||
// 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).
|
||||
//
|
||||
// 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).
|
||||
//
|
||||
// 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).
|
||||
//
|
||||
// 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).
|
||||
//
|
||||
// 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).
|
||||
//
|
||||
// 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).
|
||||
//
|
||||
// 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).
|
||||
//
|
||||
// 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).
|
||||
//
|
||||
// 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).
|
||||
//
|
||||
// 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).
|
||||
//
|
||||
// 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).
|
||||
//
|
||||
// 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).
|
||||
//
|
||||
// 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).
|
||||
//
|
||||
// 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).
|
||||
//
|
||||
// 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).
|
||||
//
|
||||
// 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).
|
||||
//
|
||||
// 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).
|
||||
//
|
||||
// This work is licensed under the terms of the MIT license.
|
||||
|
@ -144,7 +144,7 @@ namespace client {
|
|||
}
|
||||
|
||||
void LaneInvasionSensor::Listen(CallbackFunctionType callback) {
|
||||
auto vehicle = boost::dynamic_pointer_cast<Vehicle>(GetParent());
|
||||
auto vehicle = std::dynamic_pointer_cast<Vehicle>(GetParent());
|
||||
if (vehicle == nullptr) {
|
||||
log_error(GetDisplayId(), ": not attached to a vehicle");
|
||||
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).
|
||||
//
|
||||
// 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).
|
||||
//
|
||||
// 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).
|
||||
//
|
||||
// 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).
|
||||
//
|
||||
// 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) {
|
||||
std::lock_guard<std::mutex> lock(_mutex);
|
||||
std::scoped_lock<std::mutex> lock(_mutex);
|
||||
LightState& state = const_cast<LightState&>(RetrieveLightState(id));
|
||||
state._active = active;
|
||||
_lights_changes[id] = state;
|
||||
|
@ -224,7 +224,7 @@ void LightManager::SetActive(LightId id, bool active) {
|
|||
}
|
||||
|
||||
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));
|
||||
state._color = color;
|
||||
_lights_changes[id] = state;
|
||||
|
@ -232,7 +232,7 @@ void LightManager::SetColor(LightId id, Color color) {
|
|||
}
|
||||
|
||||
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));
|
||||
state._intensity = intensity;
|
||||
_lights_changes[id] = state;
|
||||
|
@ -240,7 +240,7 @@ void LightManager::SetIntensity(LightId id, float intensity) {
|
|||
}
|
||||
|
||||
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));
|
||||
state = new_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) {
|
||||
std::lock_guard<std::mutex> lock(_mutex);
|
||||
std::scoped_lock<std::mutex> lock(_mutex);
|
||||
LightState& state = const_cast<LightState&>(RetrieveLightState(id));
|
||||
state._group = group;
|
||||
_lights_changes[id] = state;
|
||||
|
@ -271,7 +271,7 @@ const LightState& LightManager::RetrieveLightState(LightId id) const {
|
|||
}
|
||||
|
||||
void LightManager::QueryLightsStateToServer() {
|
||||
std::lock_guard<std::mutex> lock(_mutex);
|
||||
std::scoped_lock<std::mutex> lock(_mutex);
|
||||
// Send blocking query
|
||||
std::vector<rpc::LightState> lights_snapshot = _episode.Lock()->QueryLightsStateToServer();
|
||||
|
||||
|
@ -294,7 +294,7 @@ void LightManager::QueryLightsStateToServer() {
|
|||
}
|
||||
|
||||
void LightManager::UpdateServerLightsState(bool discard_client) {
|
||||
std::lock_guard<std::mutex> lock(_mutex);
|
||||
std::scoped_lock<std::mutex> lock(_mutex);
|
||||
|
||||
if(_dirty) {
|
||||
std::vector<rpc::LightState> message;
|
||||
|
@ -321,7 +321,7 @@ void LightManager::UpdateServerLightsState(bool discard_client) {
|
|||
}
|
||||
|
||||
void LightManager::ApplyChanges() {
|
||||
std::lock_guard<std::mutex> lock(_mutex);
|
||||
std::scoped_lock<std::mutex> lock(_mutex);
|
||||
for(const auto& it : _lights_changes) {
|
||||
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).
|
||||
//
|
||||
// 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).
|
||||
//
|
||||
// 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).
|
||||
//
|
||||
// This work is licensed under the terms of the MIT license.
|
||||
|
@ -45,7 +45,7 @@ namespace client {
|
|||
const geom::Location &location,
|
||||
bool project_to_road,
|
||||
int32_t lane_type) const {
|
||||
boost::optional<road::element::Waypoint> waypoint;
|
||||
std::optional<road::element::Waypoint> waypoint;
|
||||
if (project_to_road) {
|
||||
waypoint = _map.GetClosestWaypointOnRoad(location, lane_type);
|
||||
} else {
|
||||
|
@ -60,7 +60,7 @@ namespace client {
|
|||
carla::road::RoadId road_id,
|
||||
carla::road::LaneId lane_id,
|
||||
float s) const {
|
||||
boost::optional<road::element::Waypoint> waypoint;
|
||||
std::optional<road::element::Waypoint> waypoint;
|
||||
waypoint = _map.GetWaypoint(road_id, lane_id, s);
|
||||
return waypoint.has_value() ?
|
||||
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).
|
||||
//
|
||||
// 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).
|
||||
//
|
||||
// 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).
|
||||
//
|
||||
// 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).
|
||||
//
|
||||
// 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).
|
||||
//
|
||||
// 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).
|
||||
//
|
||||
// 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).
|
||||
//
|
||||
// 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).
|
||||
//
|
||||
// This work is licensed under the terms of the MIT license.
|
||||
|
@ -69,7 +69,7 @@ namespace client {
|
|||
auto ids = GetEpisode().Lock()->GetGroupTrafficLights(*this);
|
||||
for (auto id : ids) {
|
||||
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;
|
||||
}
|
||||
|
|
|
@ -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).
|
||||
//
|
||||
// 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).
|
||||
//
|
||||
// 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).
|
||||
//
|
||||
// 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).
|
||||
//
|
||||
// This work is licensed under the terms of the MIT license.
|
||||
|
@ -117,7 +117,7 @@ namespace client {
|
|||
|
||||
SharedPtr<TrafficLight> Vehicle::GetTrafficLight() const {
|
||||
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) {
|
||||
|
|
|
@ -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).
|
||||
//
|
||||
// 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).
|
||||
//
|
||||
// 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).
|
||||
//
|
||||
// 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).
|
||||
//
|
||||
// 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();
|
||||
if (nav != nullptr) {
|
||||
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).
|
||||
//
|
||||
// This work is licensed under the terms of the MIT license.
|
||||
|
@ -9,7 +9,7 @@
|
|||
#include "carla/client/Actor.h"
|
||||
#include "carla/geom/Vector3D.h"
|
||||
|
||||
#include <boost/optional.hpp>
|
||||
#include <optional>
|
||||
|
||||
namespace carla {
|
||||
namespace client {
|
||||
|
@ -23,7 +23,7 @@ namespace client {
|
|||
|
||||
void Stop();
|
||||
|
||||
boost::optional<geom::Location> GetRandomLocation();
|
||||
std::optional<geom::Location> GetRandomLocation();
|
||||
|
||||
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).
|
||||
//
|
||||
// This work is licensed under the terms of the MIT license.
|
||||
|
@ -145,18 +145,18 @@ namespace client {
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
boost::optional<road::element::LaneMarking> Waypoint::GetRightLaneMarking() const {
|
||||
std::optional<road::element::LaneMarking> Waypoint::GetRightLaneMarking() const {
|
||||
if (_mark_record.first != nullptr) {
|
||||
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) {
|
||||
return road::element::LaneMarking(*_mark_record.second);
|
||||
}
|
||||
return boost::optional<road::element::LaneMarking>{};
|
||||
return std::optional<road::element::LaneMarking>{};
|
||||
}
|
||||
|
||||
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).
|
||||
//
|
||||
// This work is licensed under the terms of the MIT license.
|
||||
|
@ -15,7 +15,7 @@
|
|||
#include "carla/road/Lane.h"
|
||||
#include "carla/road/RoadTypes.h"
|
||||
|
||||
#include <boost/optional.hpp>
|
||||
#include <optional>
|
||||
|
||||
namespace carla {
|
||||
namespace client {
|
||||
|
@ -85,9 +85,9 @@ namespace client {
|
|||
|
||||
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;
|
||||
|
||||
|
|
|
@ -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).
|
||||
//
|
||||
// This work is licensed under the terms of the MIT license.
|
||||
|
@ -41,7 +41,7 @@ namespace client {
|
|||
return _episode.Lock()->GetVehiclesLightStates();
|
||||
}
|
||||
|
||||
boost::optional<geom::Location> World::GetRandomLocationFromNavigation() const {
|
||||
std::optional<geom::Location> World::GetRandomLocationFromNavigation() const {
|
||||
return _episode.Lock()->GetRandomLocationFromNavigation();
|
||||
}
|
||||
|
||||
|
@ -68,7 +68,7 @@ namespace client {
|
|||
for (auto i = 0u; i < number_of_attemps; i++) {
|
||||
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())
|
||||
tics_correct++;
|
||||
|
||||
|
@ -237,7 +237,7 @@ namespace client {
|
|||
_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 {
|
||||
auto result = _episode.Lock()->ProjectPoint(location, direction, search_distance);
|
||||
if (result.first) {
|
||||
|
@ -246,7 +246,7 @@ namespace client {
|
|||
return {};
|
||||
}
|
||||
|
||||
boost::optional<rpc::LabelledPoint> World::GroundProjection(
|
||||
std::optional<rpc::LabelledPoint> World::GroundProjection(
|
||||
geom::Location location, float search_distance) const {
|
||||
const geom::Vector3D DownVector(0,0,-1);
|
||||
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).
|
||||
//
|
||||
// This work is licensed under the terms of the MIT license.
|
||||
|
@ -29,7 +29,7 @@
|
|||
#include "carla/rpc/Texture.h"
|
||||
#include "carla/rpc/MaterialParameter.h"
|
||||
|
||||
#include <boost/optional.hpp>
|
||||
#include <optional>
|
||||
|
||||
namespace carla {
|
||||
namespace client {
|
||||
|
@ -76,7 +76,7 @@ namespace client {
|
|||
rpc::VehicleLightStateList GetVehiclesLightStates() const;
|
||||
|
||||
/// 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
|
||||
/// simulator window.
|
||||
|
@ -177,10 +177,10 @@ namespace client {
|
|||
std::vector<uint64_t> env_objects_ids,
|
||||
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;
|
||||
|
||||
boost::optional<rpc::LabelledPoint> GroundProjection(
|
||||
std::optional<rpc::LabelledPoint> GroundProjection(
|
||||
geom::Location location, float search_distance = 10000.0) const;
|
||||
|
||||
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).
|
||||
//
|
||||
// This work is licensed under the terms of the MIT license.
|
||||
|
@ -10,7 +10,7 @@
|
|||
#include "carla/client/ActorSnapshot.h"
|
||||
#include "carla/client/detail/EpisodeState.h"
|
||||
|
||||
#include <boost/optional.hpp>
|
||||
#include <optional>
|
||||
|
||||
namespace carla {
|
||||
namespace client {
|
||||
|
@ -41,7 +41,7 @@ namespace client {
|
|||
}
|
||||
|
||||
/// 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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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).
|
||||
//
|
||||
// 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).
|
||||
//
|
||||
// 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).
|
||||
//
|
||||
// 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).
|
||||
//
|
||||
// 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).
|
||||
//
|
||||
// This work is licensed under the terms of the MIT license.
|
||||
|
@ -16,7 +16,7 @@ namespace detail {
|
|||
void ActorVariant::MakeActor(EpisodeProxy episode) const {
|
||||
_value = detail::ActorFactory::MakeActor(
|
||||
episode,
|
||||
boost::variant2::get<rpc::Actor>(std::move(_value)),
|
||||
std::get<rpc::Actor>(std::move(_value)),
|
||||
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).
|
||||
//
|
||||
// This work is licensed under the terms of the MIT license.
|
||||
|
@ -16,10 +16,10 @@
|
|||
#pragma warning(push)
|
||||
#pragma warning(disable:4583)
|
||||
#pragma warning(disable:4582)
|
||||
#include <boost/variant2/variant.hpp>
|
||||
#include <variant>
|
||||
#pragma warning(pop)
|
||||
#else
|
||||
#include <boost/variant2/variant.hpp>
|
||||
#include <variant>
|
||||
#endif
|
||||
|
||||
namespace carla {
|
||||
|
@ -51,11 +51,11 @@ namespace detail {
|
|||
MakeActor(episode);
|
||||
}
|
||||
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 {
|
||||
return boost::variant2::visit(Visitor(), _value);
|
||||
return std::visit(Visitor(), _value);
|
||||
}
|
||||
|
||||
ActorId GetId() const {
|
||||
|
@ -91,7 +91,7 @@ namespace detail {
|
|||
|
||||
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
|
||||
|
|
|
@ -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).
|
||||
//
|
||||
// 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
|
||||
/// 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.
|
||||
template <typename RangeT>
|
||||
|
@ -64,7 +64,7 @@ namespace detail {
|
|||
// ===========================================================================
|
||||
|
||||
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;
|
||||
_actors.emplace(id, std::move(actor));
|
||||
}
|
||||
|
@ -78,7 +78,7 @@ namespace detail {
|
|||
auto make_iterator = [&make_a_pair](auto it) {
|
||||
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)));
|
||||
}
|
||||
|
||||
|
@ -86,27 +86,27 @@ namespace detail {
|
|||
inline std::vector<ActorId> CachedActorList::GetMissingIds(const RangeT &range) const {
|
||||
std::vector<ActorId> result;
|
||||
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) {
|
||||
return _actors.find(id) == _actors.end();
|
||||
});
|
||||
return result;
|
||||
}
|
||||
|
||||
inline boost::optional<rpc::Actor> CachedActorList::GetActorById(ActorId id) const {
|
||||
std::lock_guard<std::mutex> lock(_mutex);
|
||||
inline std::optional<rpc::Actor> CachedActorList::GetActorById(ActorId id) const {
|
||||
std::scoped_lock<std::mutex> lock(_mutex);
|
||||
auto it = _actors.find(id);
|
||||
if (it != _actors.end()) {
|
||||
return it->second;
|
||||
}
|
||||
return boost::none;
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
template <typename RangeT>
|
||||
inline std::vector<rpc::Actor> CachedActorList::GetActorsById(const RangeT &range) const {
|
||||
std::vector<rpc::Actor> result;
|
||||
result.reserve(range.size());
|
||||
std::lock_guard<std::mutex> lock(_mutex);
|
||||
std::scoped_lock<std::mutex> lock(_mutex);
|
||||
for (auto &&id : range) {
|
||||
auto it = _actors.find(id);
|
||||
if (it != _actors.end()) {
|
||||
|
@ -117,7 +117,7 @@ namespace detail {
|
|||
}
|
||||
|
||||
inline void CachedActorList::Clear() {
|
||||
std::lock_guard<std::mutex> lock(_mutex);
|
||||
std::scoped_lock<std::mutex> lock(_mutex);
|
||||
_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).
|
||||
//
|
||||
// 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).
|
||||
//
|
||||
// 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).
|
||||
//
|
||||
// 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).
|
||||
//
|
||||
// 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);
|
||||
if (!actor.has_value()) {
|
||||
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).
|
||||
//
|
||||
// This work is licensed under the terms of the MIT license.
|
||||
|
@ -54,13 +54,13 @@ namespace detail {
|
|||
_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> GetActors();
|
||||
|
||||
boost::optional<WorldSnapshot> WaitForState(time_duration timeout) {
|
||||
std::optional<WorldSnapshot> WaitForState(time_duration 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).
|
||||
//
|
||||
// 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).
|
||||
//
|
||||
// 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).
|
||||
//
|
||||
// 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).
|
||||
//
|
||||
// This work is licensed under the terms of the MIT license.
|
||||
|
@ -14,7 +14,7 @@
|
|||
#include "carla/geom/Vector3DInt.h"
|
||||
#include "carla/sensor/data/RawEpisodeState.h"
|
||||
|
||||
#include <boost/optional.hpp>
|
||||
#include <optional>
|
||||
|
||||
#include <memory>
|
||||
#include <unordered_map>
|
||||
|
@ -70,8 +70,8 @@ namespace detail {
|
|||
return state;
|
||||
}
|
||||
|
||||
boost::optional<ActorSnapshot> GetActorSnapshotIfPresent(ActorId id) const {
|
||||
boost::optional<ActorSnapshot> state;
|
||||
std::optional<ActorSnapshot> GetActorSnapshotIfPresent(ActorId id) const {
|
||||
std::optional<ActorSnapshot> state;
|
||||
CopyActorSnapshotIfPresent(id, 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).
|
||||
//
|
||||
// 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. "
|
||||
"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)) {
|
||||
log_warning(
|
||||
|
@ -320,7 +320,7 @@ EpisodeProxy Simulator::GetCurrentEpisode() {
|
|||
nav->UnregisterWalker(walker->GetId(), controller.GetId());
|
||||
}
|
||||
|
||||
boost::optional<geom::Location> Simulator::GetRandomLocationFromNavigation() {
|
||||
std::optional<geom::Location> Simulator::GetRandomLocationFromNavigation() {
|
||||
DEBUG_ASSERT(_episode != nullptr);
|
||||
auto nav = _episode->CreateNavigationIfMissing();
|
||||
return nav->GetRandomLocation();
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue