diff --git a/MantleAPI/BUILD.bazel b/MantleAPI/BUILD.bazel index e533abec4c1db71434c6c4ebe9edad9ef300620d..54b5d534ac46b3cfa452c404d6fcf197617294f1 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 7fd924a26d69b4a1e9541d71c4b6f09c43035e9c..0000000000000000000000000000000000000000 --- 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 e9b08fc13f456be34214299a2b402632af0e3237..7c031c84bb08cdc637b9cb6b4e1bc1eb3cbe265c 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 7d6ac794053780870cd6b1b9cb8ab6c1c879c311..0e591df5d25630eda003eddae8f23dfe3f350016 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 6bb16d4e012247bdf680597d5633dbae64438fcd..c11fe9d4bb741a1eb4cf3264e4a9eb13dfa5b691 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 51bf3fdf915a4c76b9009566729b28dd7a95c698..67a5ecf66c2518305109c3b215de4b18905dab4e 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 e31998126c1aab953ecae282eaf7549f7ffb44a6..539914fb0af5a9e6ffdc7b1ec1de9d89c312fcee 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