ad_map_access
RoutePrediction.hpp
Go to the documentation of this file.
1 // ----------------- BEGIN LICENSE BLOCK ---------------------------------
2 //
3 // Copyright (C) 2018-2021 Intel Corporation
4 //
5 // SPDX-License-Identifier: MIT
6 //
7 // ----------------- END LICENSE BLOCK -----------------------------------
12 #pragma once
13 
14 #include <deque>
15 #include <map>
17 #include "ad/map/route/Routing.hpp"
18 
20 namespace ad {
22 namespace map {
24 namespace route {
28 namespace planning {
29 
31 {
32 };
33 
37 class RoutePrediction : public RouteExpander<RoutePredictionScore>
38 {
39 public:
41 
55  RoutePrediction(const RoutingParaPoint &start,
56  physics::Distance const &predictionDistance,
57  physics::Duration const &predictionDuration,
59 
71  RoutePrediction(const RoutingParaPoint &start,
72  physics::Distance const &predictionDistance,
74 
86  RoutePrediction(const RoutingParaPoint &start,
87  physics::Duration const &predictionDuration,
89 
93  bool calculate() override;
94 
95 private:
99  void addNeighbor(lane::Lane::ConstPtr originLane,
100  RoutingPoint const &origin,
101  lane::Lane::ConstPtr neighborLane,
102  RoutingPoint const &neighbor,
103  ExpandReason const &expandReason) override;
104 
108  void insertNeighbor(RoutingPoint const &origin, RoutingPoint const &neighbor);
109 
113  struct RouteTreeElement
114  {
116  RouteTreeElement(RouteTreeElement const *parent, RoutingPoint const &iRoutingPoint)
117  : routingPoint(iRoutingPoint)
118  , theParent(parent)
119  {
120  }
121 
124  {
125  bool operator()(const std::shared_ptr<RouteTreeElement> &left,
126  const std::shared_ptr<RouteTreeElement> &right) const
127  {
128  return left->routingPoint.first < right->routingPoint.first;
129  }
130  };
131 
132  typedef std::set<std::shared_ptr<RouteTreeElement>, RouteTreeElementCompare> RouteTreeElementUniqueRoutePointSet;
133 
135  RoutingPoint routingPoint;
137  RouteTreeElementUniqueRoutePointSet children;
139  RouteTreeElement const *theParent;
140  };
141 
145  void reconstructPaths();
146 
148  std::shared_ptr<RouteTreeElement> mRouteTreeRoot;
149 
153  std::map<RoutingParaPoint, RouteTreeElement::RouteTreeElementUniqueRoutePointSet> mProcessedTransitions;
154 
156  std::deque<std::shared_ptr<RouteTreeElement>> mElementsToProcess;
157 };
158 
159 } // namespace planning
160 } // namespace route
161 } // namespace map
162 } // namespace ad
ad
namespace ad
Definition: GeometryStoreItem.hpp:28
ad::map::route::planning::RouteExpander
Implements routing support functionality on the lane network.
Definition: RouteExpander.hpp:43
ad::map::route::planning::RouteExpander::RoutingPoint
std::pair< RoutingParaPoint, RoutingCost > RoutingPoint
definition of the routing point
Definition: RouteExpander.hpp:54
ad::map::route::planning::RoutePrediction::RoutingPoint
std::pair< RoutingParaPoint, RoutingCost > RoutingPoint
definition of the routing point
Definition: RouteExpander.hpp:54
ad::map::route::planning::RoutePrediction::RouteTreeElement::RouteTreeElementCompare
comparing route tree elements by their actual route-point to ensure children are unique
Definition: RoutePrediction.hpp:123
ad::map::route::planning::Route::Type
Type
Routing type.
Definition: Route.hpp:59
ad::map::route::planning::RoutePrediction
Implements route prediction on the lane network.
Definition: RoutePrediction.hpp:37
ad::map::route::planning::RoutePrediction::RoutePrediction
RoutePrediction(const RoutingParaPoint &start, physics::Distance const &predictionDistance, physics::Duration const &predictionDuration, Type typ=Route::Type::SHORTEST)
Constructor.
RouteExpander.hpp
ad::map::route::planning::Route::Type::SHORTEST
@ SHORTEST
Shortest route by distance.
Routing.hpp
ad::map::route::planning::RoutePrediction::calculate
bool calculate() override
Calculates the route predictions using breadth search algorithm.
ad::map::route::planning::RoutingParaPoint
routing para point
Definition: Routing.hpp:44
ad::map::lane::Lane::ConstPtr
std::shared_ptr< Lane const > ConstPtr
Smart pointer on constant Lane.
Definition: Lane.hpp:66
ad::map::route::planning::RoutePredictionScore
Definition: RoutePrediction.hpp:30
ad::map::route::planning::RouteExpander< RoutePredictionScore >::ExpandReason
ExpandReason
Definition of the reasons for route expansion.
Definition: RouteExpander.hpp:110