From 7286c440a69babbd7a0531a3d6c7be27bf3dd94c Mon Sep 17 00:00:00 2001 From: Andreas Rauschert <andreas.rb.rauschert@bmw.de> Date: Wed, 6 Oct 2021 17:16:42 +0200 Subject: [PATCH] Update after review and fix test build --- MantleAPI/BUILD.bazel | 3 ++ .../MantleAPI/Common/simulation_time.h | 29 ------------------- .../MantleAPI/Execution/i_environment.h | 3 +- .../MantleAPI/Traffic/entity_properties.h | 2 +- MantleAPI/test/MantleAPI/Test/test_utils.h | 11 +++---- MantleAPI/test/interface_test.cpp | 2 +- README.md | 7 +++++ 7 files changed, 19 insertions(+), 38 deletions(-) delete mode 100644 MantleAPI/include/MantleAPI/Common/simulation_time.h diff --git a/MantleAPI/BUILD.bazel b/MantleAPI/BUILD.bazel index e533abec..54b5d534 100644 --- a/MantleAPI/BUILD.bazel +++ b/MantleAPI/BUILD.bazel @@ -19,6 +19,9 @@ cc_library( visibility = [ "//visibility:public", ], + deps = [ + "@units", + ], ) cc_library( diff --git a/MantleAPI/include/MantleAPI/Common/simulation_time.h b/MantleAPI/include/MantleAPI/Common/simulation_time.h deleted file mode 100644 index 7fd924a2..00000000 --- a/MantleAPI/include/MantleAPI/Common/simulation_time.h +++ /dev/null @@ -1,29 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2021, Bayerische Motoren Werke Aktiengesellschaft (BMW AG) - * - * This program and the accompanying materials are made - * available under the terms of the Eclipse Public License 2.0 - * which is available at https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - *******************************************************************************/ - -//----------------------------------------------------------------------------- -/** @file simulation_time.h */ -//----------------------------------------------------------------------------- - -#ifndef MANTLEAPI_COMMON_SIMULATION_TIME_H -#define MANTLEAPI_COMMON_SIMULATION_TIME_H - -#include <MantleAPI/Common/time_utils.h> - -namespace mantle_api -{ -struct SimulationTime -{ - Time current_sim_time{0}; - Time last_delta_time{0}; -}; - -} // namespace mantle_api -#endif // MANTLEAPI_COMMON_SIMULATION_TIME_H diff --git a/MantleAPI/include/MantleAPI/Execution/i_environment.h b/MantleAPI/include/MantleAPI/Execution/i_environment.h index e9b08fc1..7c031c84 100644 --- a/MantleAPI/include/MantleAPI/Execution/i_environment.h +++ b/MantleAPI/include/MantleAPI/Execution/i_environment.h @@ -15,7 +15,6 @@ #ifndef MANTLEAPI_EXECUTION_IENVIRONMENT_H #define MANTLEAPI_EXECUTION_IENVIRONMENT_H -#include <MantleAPI/Common/simulation_time.h> #include <MantleAPI/Common/time_utils.h> #include <MantleAPI/EnvironmentalConditions/road_condition.h> #include <MantleAPI/EnvironmentalConditions/weather.h> @@ -77,7 +76,7 @@ public: virtual void SetDateTime(mantle_api::Time time) = 0; virtual mantle_api::Time GetDateTime() = 0; - /// @brief Time since start of simulation and delta time to previous step + /// @brief Time since start of simulation virtual mantle_api::Time GetSimulationTime() = 0; virtual void SetWeather(Weather weather) = 0; diff --git a/MantleAPI/include/MantleAPI/Traffic/entity_properties.h b/MantleAPI/include/MantleAPI/Traffic/entity_properties.h index 7d6ac794..0e591df5 100644 --- a/MantleAPI/include/MantleAPI/Traffic/entity_properties.h +++ b/MantleAPI/include/MantleAPI/Traffic/entity_properties.h @@ -176,7 +176,7 @@ struct PedestrianProperties : public EntityProperties struct StaticObjectProperties : public EntityProperties { - units::length::meter_t upwards_shift{0.0}; + units::length::meter_t z_placement_offset{0.0}; }; } // namespace mantle_api diff --git a/MantleAPI/test/MantleAPI/Test/test_utils.h b/MantleAPI/test/MantleAPI/Test/test_utils.h index 6bb16d4e..c11fe9d4 100644 --- a/MantleAPI/test/MantleAPI/Test/test_utils.h +++ b/MantleAPI/test/MantleAPI/Test/test_utils.h @@ -35,7 +35,7 @@ class MockConverter : public mantle_api::ICoordConverter public: MOCK_METHOD(mantle_api::Vec3<units::length::meter_t>, Convert, (mantle_api::Position position), (const override)); - mantle_api::Position Convert(mantle_api::Vec3<units::length::meter_t> vec) const override + mantle_api::Position Convert(const mantle_api::Vec3<units::length::meter_t>& vec) const override { std::ignore = vec; return mantle_api::Position{}; @@ -270,13 +270,13 @@ public: CreateStaticObjectProxy, (const std::string& name, const mantle_api::StaticObjectProperties& properties), ()); - mantle_api::IEntity& Get(const std::string& name) override + std::optional<std::reference_wrapper<IEntity>> Get(const std::string& name) override { std::ignore = name; return test_vehicle_; } - mantle_api::IEntity& Get(mantle_api::UniqueId id) override + std::optional<std::reference_wrapper<IEntity>> Get(mantle_api::UniqueId id) override { std::ignore = id; return test_vehicle_; @@ -294,8 +294,9 @@ public: } void Delete(UniqueId id) override { std::ignore = id; } - // const std::vector<mantle_api::IEntity>& GetEntities() const override { return <#initializer #>{}; } - // std::vector<mantle_api::IEntity>& GetEntities() override { return <#initializer #>; } + void RegisterEntityCreatedCallback(const std::function<void(IEntity&)>& callback) override { std::ignore = callback; } + void RegisterEntityDeletedCallback(const std::function<void(const std::string&)>& callback) override { std::ignore = callback; } + void RegisterEntityDeletedCallback(const std::function<void(UniqueId)>& callback) override { std::ignore = callback; } private: MockVehicle test_vehicle_{}; diff --git a/MantleAPI/test/interface_test.cpp b/MantleAPI/test/interface_test.cpp index 51bf3fdf..67a5ecf6 100644 --- a/MantleAPI/test/interface_test.cpp +++ b/MantleAPI/test/interface_test.cpp @@ -17,7 +17,7 @@ TEST(InterfaceTest, GivenTeleportAction_When_ThenHostVehicleIsPlaced) { mantle_api::Position inert_pos{}; - inert_pos = mantle_api::OpenDrivePosition{{0, 0}, 0, 0}; + inert_pos = mantle_api::OpenDrivePosition{{0, 0}, units::length::meter_t{0}, units::length::meter_t{0}}; mantle_api::MockEnvironment env{}; env.CreateMap("dummy_map_path", {}); diff --git a/README.md b/README.md index e3199812..539914fb 100644 --- a/README.md +++ b/README.md @@ -4,3 +4,10 @@ A collection of interfaces for abstraction between a scenario engine and an envi It is intended to be usable with a wide variety of scenario description languages by implementing according scenario engines. Remark: This is currently work in progress and no stable state is reached yet. + +## Used libraries + +### Units +License: MIT License +URL: https://github.com/nholthaus/units +Version: v2.3.1 -- GitLab