diff --git a/MantleAPI/include/MantleAPI/Common/route_definition.h b/MantleAPI/include/MantleAPI/Common/route_definition.h new file mode 100644 index 0000000000000000000000000000000000000000..ff5e5761e42ac7fdcde5c0c7fecffb81a1d590f7 --- /dev/null +++ b/MantleAPI/include/MantleAPI/Common/route_definition.h @@ -0,0 +1,48 @@ +/******************************************************************************* + * Copyright (c) 2022, 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 route_definition.h */ +//----------------------------------------------------------------------------- + +#ifndef MANTLEAPI_COMMON_ROUTE_DEFINITION_H +#define MANTLEAPI_COMMON_ROUTE_DEFINITION_H + +#include <MantleAPI/Common/vector.h> +#include <units.h> +#include <vector> + +namespace mantle_api +{ +/// Defines how a route should be calculated +enum class RouteStrategy +{ + kUndefined = 0, + kFastest, + kLeastIntersections, + kShortest +}; + +/// Groups a Waypoint with a RouteStrategy +struct RouteWaypoint +{ + mantle_api::Vec3<units::length::meter_t> waypoint{}; + RouteStrategy route_strategy{RouteStrategy::kUndefined}; +}; + +/// Serves as a raw set of global coordinates and information for +/// linking them, from which the actual route can be calculated +struct RouteDefinition +{ + std::vector<mantle_api::RouteWaypoint> waypoints{}; +}; + +} // namespace mantle_api +#endif // MANTLEAPI_COMMON_ROUTE_DEFINITION_H diff --git a/MantleAPI/include/MantleAPI/Execution/i_environment.h b/MantleAPI/include/MantleAPI/Execution/i_environment.h index 2a27e2f00e647547458ac4c4603bbbaca74d109d..fd9bc7b6c7380837ec26c9df7af8e47d9e3b1814 100644 --- a/MantleAPI/include/MantleAPI/Execution/i_environment.h +++ b/MantleAPI/include/MantleAPI/Execution/i_environment.h @@ -16,6 +16,7 @@ #define MANTLEAPI_EXECUTION_IENVIRONMENT_H #include <MantleAPI/Common/i_geometry_helper.h> +#include <MantleAPI/Common/route_definition.h> #include <MantleAPI/Common/time_utils.h> #include <MantleAPI/EnvironmentalConditions/road_condition.h> #include <MantleAPI/EnvironmentalConditions/weather.h> @@ -107,6 +108,12 @@ public: /// /// @param default_routing_behavior selects the behavior virtual void SetDefaultRoutingBehavior(mantle_api::DefaultRoutingBehavior default_routing_behavior) = 0; + + /// Assigns a route to an entity + /// + /// @param entity_id specifies the entity + /// @param route_definition specifies how the route shall be constructed + virtual void AssignRoute(mantle_api::UniqueId entity_id, mantle_api::RouteDefinition route_definition) = 0; }; } // namespace mantle_api diff --git a/MantleAPI/include/MantleAPI/Traffic/control_strategy.h b/MantleAPI/include/MantleAPI/Traffic/control_strategy.h index 21a5338cae188c20559a89dfa876f908946db2b5..85f87a5962b01324b1e66bf5564c445237a30796 100644 --- a/MantleAPI/include/MantleAPI/Traffic/control_strategy.h +++ b/MantleAPI/include/MantleAPI/Traffic/control_strategy.h @@ -43,30 +43,12 @@ enum class ControlStrategyType kFollowHeadingSpline, kFollowLateralOffsetSpline, kFollowVelocitySpline, - kFollowRoute, kAcquireLaneOffset, kFollowTrajectory, kUpdateTrafficLightStates, kPerformLaneChange }; -/// @brief Defines how a route should be calculated -enum class RouteStrategy -{ - kUndefined = 0, - kFastest, - kLeastIntersections, - kShortest -}; - -/// @brief Groups a Waypoint with a RouteStrategy -/// for the \ref FollowRouteControlStrategy -struct RouteWaypoint -{ - mantle_api::Vec3<units::length::meter_t> waypoint{}; - RouteStrategy route_strategy{RouteStrategy::kUndefined}; -}; - struct ControlStrategy { virtual ~ControlStrategy() = default; @@ -154,17 +136,6 @@ struct FollowLateralOffsetSplineControlStrategy : public ControlStrategy std::vector<mantle_api::SplineSection<units::length::meter>> lateral_offset_splines; }; -struct FollowRouteControlStrategy : public ControlStrategy -{ - FollowRouteControlStrategy() - { - movement_domain = MovementDomain::kLateral; - type = ControlStrategyType::kFollowRoute; - } - - std::vector<RouteWaypoint> route_waypoints; -}; - enum class Dimension { kUndefined = 0, diff --git a/MantleAPI/test/MantleAPI/Test/test_utils.h b/MantleAPI/test/MantleAPI/Test/test_utils.h index 5a6e6ed5419b2f7bd7986e0b47e2f909b62838d0..64dac7c158eba898a2bedd4111e863e58502c561 100644 --- a/MantleAPI/test/MantleAPI/Test/test_utils.h +++ b/MantleAPI/test/MantleAPI/Test/test_utils.h @@ -483,6 +483,11 @@ public: (mantle_api::DefaultRoutingBehavior default_routing_behavior), (override)); + MOCK_METHOD(void, + AssignRoute, + (mantle_api::UniqueId entity_id, mantle_api::RouteDefinition route_definition), + (override)); + private: MockQueryService query_service_{}; MockEntityRepository entity_repository_{};