diff --git a/.bazelversion b/.bazelversion new file mode 100644 index 0000000000000000000000000000000000000000..b26a34e470564db32e10075b9d1a6236dc91f6b5 --- /dev/null +++ b/.bazelversion @@ -0,0 +1 @@ +7.2.1 diff --git a/include/MantleAPI/Execution/i_environment.h b/include/MantleAPI/Execution/i_environment.h index 235b6312ef3cc3e5a140c511def54c7f341d6433..41e80fd57ffd43828567ac560cea8a1971f44073 100644 --- a/include/MantleAPI/Execution/i_environment.h +++ b/include/MantleAPI/Execution/i_environment.h @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2021-2023, Bayerische Motoren Werke Aktiengesellschaft (BMW AG) + * Copyright (c) 2021-2024, Bayerische Motoren Werke Aktiengesellschaft (BMW AG) * Copyright (c) 2024, Mercedes-Benz Tech Innovation GmbH * * This program and the accompanying materials are made @@ -88,7 +88,7 @@ public: /// @brief Retrieves the coord converter that provides transformation of different position types, curvature, elevation etc. /// /// @return pointer to the coord converter interface - [[nodiscard]] virtual const ICoordConverter* GetConverter() const = 0; + [[nodiscard]] virtual ICoordConverter* GetConverter() = 0; /// @brief Retrieves the geometry helper that provides functionality to perform geometrical calculations /// diff --git a/include/MantleAPI/Map/i_coord_converter.h b/include/MantleAPI/Map/i_coord_converter.h index b261986e06f4b6d92114a592c6f72b58a5ecf042..6bbc8e43a79f33f7799a83ed1aaf1954aebf0c2b 100644 --- a/include/MantleAPI/Map/i_coord_converter.h +++ b/include/MantleAPI/Map/i_coord_converter.h @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2021-2023, Bayerische Motoren Werke Aktiengesellschaft (BMW AG) + * Copyright (c) 2021-2024, 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 @@ -15,6 +15,7 @@ #ifndef MANTLEAPI_MAP_I_COORD_CONVERTER_H #define MANTLEAPI_MAP_I_COORD_CONVERTER_H +#include <MantleAPI/Common/orientation.h> #include <MantleAPI/Common/position.h> #include <MantleAPI/Common/vector.h> #include <units.h> @@ -29,11 +30,25 @@ class ICoordConverter public: virtual ~ICoordConverter() = default; - /// Converts a track position to its corresponding inertial position. + /// Converts a position of any kind to its corresponding inertial position. /// - /// @param position Track position. Coordinate system is implicitly defined by underlying type of Position + /// @param position The input position. Coordinate system is implicitly defined by underlying type of Position /// @return Inertial position - [[nodiscard]] virtual Vec3<units::length::meter_t> Convert(Position position) const = 0; + [[nodiscard]] virtual Vec3<units::length::meter_t> Convert(Position position) = 0; + + /// Calculates the orientation of the lane center line at a given lane position. + /// + /// @param open_drive_lane_position Position specified in a lane coordinate system (road id, local lane id, s) + /// @return Orientation of the lane center line at the specified position in inertial coordinates + [[nodiscard]] virtual Orientation3<units::angle::radian_t> GetLaneOrientation( + const OpenDriveLanePosition& open_drive_lane_position) = 0; + + /// Calculates the orientation of the road reference line at a given road position. + /// + /// @param open_drive_road_position Position specified in a road coordinate system (road id, s) + /// @return Orientation of the road reference line at the specified position in inertial coordinates + [[nodiscard]] virtual Orientation3<units::angle::radian_t> GetRoadOrientation( + const OpenDriveRoadPosition& open_drive_road_position) = 0; }; } // namespace mantle_api diff --git a/test/MantleAPI/Test/test_utils.h b/test/MantleAPI/Test/test_utils.h index 248ec27f6c74714989e64c86e0fd632d71441528..902bddf569da39d0556bde0863684fbe6e734dec 100644 --- a/test/MantleAPI/Test/test_utils.h +++ b/test/MantleAPI/Test/test_utils.h @@ -68,7 +68,9 @@ public: class MockConverter : public mantle_api::ICoordConverter { public: - MOCK_METHOD(mantle_api::Vec3<units::length::meter_t>, Convert, (mantle_api::Position position), (const override)); + MOCK_METHOD(mantle_api::Vec3<units::length::meter_t>, Convert, (mantle_api::Position position), (override)); + MOCK_METHOD(Orientation3<units::angle::radian_t>, GetLaneOrientation, (const OpenDriveLanePosition& open_drive_lane_position), (override)); + MOCK_METHOD(Orientation3<units::angle::radian_t>, GetRoadOrientation, (const OpenDriveRoadPosition& open_drive_road_position), (override)); }; class MockVehicle : public mantle_api::IVehicle @@ -532,7 +534,7 @@ public: const mantle_api::ILaneLocationQueryService& GetQueryService() const override { return query_service_; } - const mantle_api::ICoordConverter* GetConverter() const override { return &converter_; } + mantle_api::ICoordConverter* GetConverter() override { return &converter_; } const mantle_api::IGeometryHelper* GetGeometryHelper() const override { return &geometry_helper_; } diff --git a/test/interface_test.cpp b/test/interface_test.cpp index 26727437599469487b8cace90f21052fd59f88db..f22d8eddbe30ab667cc67b0ea92ec545582eca94 100644 --- a/test/interface_test.cpp +++ b/test/interface_test.cpp @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2021, Bayerische Motoren Werke Aktiengesellschaft (BMW AG) + * Copyright (c) 2021-2024, 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 @@ -41,7 +41,7 @@ TEST(InterfaceTest, GivenTeleportAction_When_ThenHostVehicleIsPlaced) .WillByDefault(testing::ReturnRef(mock_vehicle)); auto& host_vehicle = repo.Create("host", vehicle_properties); - const auto* const converter = env.GetConverter(); + auto* converter = env.GetConverter(); auto world_pos = converter->Convert(inert_pos); host_vehicle.SetPosition(world_pos); host_vehicle.SetVisibility(mantle_api::EntityVisibilityConfig{true, false, true, {"radar"}});