Skip to content
Snippets Groups Projects
Commit ea4a2b2b authored by René Paris's avatar René Paris
Browse files

Merge branch 'feature/assign-route' into 'master'

Move responsibilty for route assignment

See merge request eclipse/simopenpass/scenario_api!64
parents 7e2c3980 6b4d7b8b
No related branches found
No related tags found
No related merge requests found
/*******************************************************************************
* 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
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
#define MANTLEAPI_EXECUTION_IENVIRONMENT_H #define MANTLEAPI_EXECUTION_IENVIRONMENT_H
#include <MantleAPI/Common/i_geometry_helper.h> #include <MantleAPI/Common/i_geometry_helper.h>
#include <MantleAPI/Common/route_definition.h>
#include <MantleAPI/Common/time_utils.h> #include <MantleAPI/Common/time_utils.h>
#include <MantleAPI/EnvironmentalConditions/road_condition.h> #include <MantleAPI/EnvironmentalConditions/road_condition.h>
#include <MantleAPI/EnvironmentalConditions/weather.h> #include <MantleAPI/EnvironmentalConditions/weather.h>
...@@ -107,6 +108,12 @@ public: ...@@ -107,6 +108,12 @@ public:
/// ///
/// @param default_routing_behavior selects the behavior /// @param default_routing_behavior selects the behavior
virtual void SetDefaultRoutingBehavior(mantle_api::DefaultRoutingBehavior default_routing_behavior) = 0; 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 } // namespace mantle_api
......
...@@ -43,30 +43,12 @@ enum class ControlStrategyType ...@@ -43,30 +43,12 @@ enum class ControlStrategyType
kFollowHeadingSpline, kFollowHeadingSpline,
kFollowLateralOffsetSpline, kFollowLateralOffsetSpline,
kFollowVelocitySpline, kFollowVelocitySpline,
kFollowRoute,
kAcquireLaneOffset, kAcquireLaneOffset,
kFollowTrajectory, kFollowTrajectory,
kUpdateTrafficLightStates, kUpdateTrafficLightStates,
kPerformLaneChange 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 struct ControlStrategy
{ {
virtual ~ControlStrategy() = default; virtual ~ControlStrategy() = default;
...@@ -154,17 +136,6 @@ struct FollowLateralOffsetSplineControlStrategy : public ControlStrategy ...@@ -154,17 +136,6 @@ struct FollowLateralOffsetSplineControlStrategy : public ControlStrategy
std::vector<mantle_api::SplineSection<units::length::meter>> lateral_offset_splines; 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 enum class Dimension
{ {
kUndefined = 0, kUndefined = 0,
......
...@@ -483,6 +483,11 @@ public: ...@@ -483,6 +483,11 @@ public:
(mantle_api::DefaultRoutingBehavior default_routing_behavior), (mantle_api::DefaultRoutingBehavior default_routing_behavior),
(override)); (override));
MOCK_METHOD(void,
AssignRoute,
(mantle_api::UniqueId entity_id, mantle_api::RouteDefinition route_definition),
(override));
private: private:
MockQueryService query_service_{}; MockQueryService query_service_{};
MockEntityRepository entity_repository_{}; MockEntityRepository entity_repository_{};
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment