ADORe
ADORe is a modular open source software library and toolkit for decision making, planning, control and simulation of automated vehicles
lanefollowingview.h
Go to the documentation of this file.
1 /********************************************************************************
2  * Copyright (C) 2017-2020 German Aerospace Center (DLR).
3  * Eclipse ADORe, Automated Driving Open Research https://eclipse.org/adore
4  *
5  * This program and the accompanying materials are made available under the
6  * terms of the Eclipse Public License 2.0 which is available at
7  * http://www.eclipse.org/legal/epl-2.0.
8  *
9  * SPDX-License-Identifier: EPL-2.0
10  *
11  * Contributors:
12  * Daniel Heß - initial API and implementation
13  * Matthias Nichting - initial API and implementation
14  ********************************************************************************/
15 
16 
17 #pragma once
18 #include <adore/env/afactory.h>
22 #include <adore/params/afactory.h>
23 #include <adore/view/alane.h>
25 //#include <adore/env/traffic/participant.h>
26 
27 
28 namespace adore
29 {
30 namespace env
31 
32 {
33 namespace BorderBased
34 {
41 class [[deprecated("lanefollowingview is superseded by threelaneviewdecoupled")]] LaneFollowingView : public adore::view::ALane
42 {
43 public:
45 
46 private:
54 public:
63  LocalRoadMap *localRoadMap,
65  : lrm_(localRoadMap), elt_(trafficMap), cs_(&lfg_)
66  {
67  apLFV_ = paramsfactory->getLaneFollowingView();
68  }
69 
72  : LaneFollowingView(adore::params::ParamsFactoryInstance::get(),localRoadMap,trafficMap)
73  {}
74 
75 
76 
77 
78  std::unordered_multimap<view::ConflictZone*, std::vector<Border*>>* getConflictSetPlotData()
79  {
80  return getConflictSetPlotData();
81  }
86  [[deprecated("lanefollowingview is superseded by threelaneviewdecoupled")]]
87  void update()
88  {
89  lfg_.update(lrm_->getBorderSet(), lrm_->getBorderTrace(),
90  lrm_->getBorderCostMap(), lrm_->getMatchedBorder(),
91  lrm_->getVehicleState(), apLFV_->getLookAhead(), apLFV_->getLookBehind(),
92  apLFV_->getBaselineFitSmoothness(), lrm_->isNavigationActive());
93  elt_.mapVehiclesOnBorders(this, *lfg_.getRightBorders()->getBorders());
94  cs_.update(lrm_->getBorderSet(),lrm_->getPrecedenceSet(), &elt_, lfg_.getRightBorders()->getBorders(),lfg_.getLeftBorders()->getBorders());
95  }
96  LocalRoadMap *getLocalRoadMap() { return lrm_; }
97 
98 
99  void getBordersToPrint(std::vector<Border*> &result,std::vector<int> &ids)
100  {
101  return cs_.getBordersToPrint(result,ids);
102  }
103 
104 
105  TLaneFollowingGeometry *getGeometry() { return &lfg_; }
106 
107 public: // methods from ALane
111  virtual bool isValid() const override { return lfg_.isValid(); }
112  virtual double getSMax() const override
113  {
114  return lfg_.getViewingDistance();
115  }
116  virtual double getSMin() const override
117  {
118  return 0.0;
119  }
124  virtual double getProgressOfWidthOpen() const override
125  {
126  return lfg_.m_s_lane_width_open;
127  }
132  virtual double getProgressOfWidthClosed() const override
133  {
134  return lfg_.m_s_lane_width_closed;
135  }
140  virtual const adore::view::TrafficQueue &getOnLaneTraffic() const override
141  {
142  return elt_.getQueue();
143  }
148  virtual const adore::view::ConflictSet &getConflictSet() const override
149  {
150  return (adore::view::ConflictSet&)cs_;
151  }
156  [[deprecated("lanefollowingview is superseded by threelaneviewdecoupled")]]
157  virtual double getSpeedLimit(double s) override { return 40.0; }
158 
159  [[deprecated("lanefollowingview is superseded by threelaneviewdecoupled")]]
160  virtual double getLeftIndicatorHint(double s) override { return 0.0; }
161 
162  [[deprecated("lanefollowingview is superseded by threelaneviewdecoupled")]]
163  virtual double getRightIndicatorHint(double s) override { return 0.0; }
169  virtual bool hasSpeedRecommendation(double s) const override { return false; }
174  virtual double getSpeedRecommendation(double s) const override { return 0.0; }
175 
176  virtual double getNavigationCost(double s) override {return 0.0;}
177  virtual void boundNavigationCost(double s0,double s1,double& cmin,double& cmax) override
178  {
179  cmin = 0.0;cmax = 0.0;
180  }
181 
182 public: // methods from ALane
186  virtual double getHeading(double s) override { return lfg_.getHeading(s); }
193  virtual double getCurvature(double s, int derivative) override
194  {
195  return lfg_.getCurvature(s, derivative);
196  }
201  virtual double getOffsetOfLeftBorder(double s) override
202  {
203  return lfg_.getOffsetOfLeftBorder(s);
204  }
209  virtual double getOffsetOfRightBorder(double s) override
210  {
211  return lfg_.getOffsetOfRightBorder(s);
212  }
217  virtual void toRelativeCoordinates(double xe, double ye, double &s,
218  double &n) override
219  {
220  lfg_.toRelativeCoordinates(xe, ye, s, n);
221  }
226  virtual void toEucledianCoordinates(double s, double n, double &xe,
227  double &ye, double &ze) override
228  {
229  lfg_.toEucledianCoordinates(s, n, xe, ye, ze);
230  }
231 
232  std::vector<Coordinate> *getCornerPoints() { return cs_.getCornerPoints(); }
233  std::vector<BorderOverlapSet> *getOverlapSet() { return cs_.getOverlapSet(); }
234  std::vector<Border *> *get_right_borders_of_conf_lanes()
235  {
236  return cs_.get_right_borders_of_conf_lanes();
237  }
238 
239 
240 
241 };
242 } // namespace BorderBased
243 } // namespace env
244 } // namespace adore
BAContainer * getBorders()
Get the Accumulated Borders.
Definition: borderaccumulator.h:386
Definition: conflictset.h:202
std::vector< Border * > * get_right_borders_of_conf_lanes()
Definition: conflictset.h:653
void update(BorderSet *borderSet, PrecedenceSet *precedenceSet, adore::env::traffic::EgoLaneTraffic *elt, BAContainer *rightBorders, BAContainer *leftBorders)
Definition: conflictset.h:224
void getBordersToPrint(std::vector< Border * > &result, std::vector< int > &ids)
Definition: conflictset.h:657
std::vector< BorderOverlapSet > * getOverlapSet()
Definition: conflictset.h:652
std::vector< Coordinate > * getCornerPoints()
Definition: conflictset.h:651
double m_s_lane_width_open
Definition: lanefollowinggeometry.h:72
void toRelativeCoordinates(double Xg, double Yg, double &s, double &n)
Transform from euclidian to relative coordinates.
Definition: lanefollowinggeometry.h:770
double getOffsetOfLeftBorder(double s)
Get the offset of the left border at a certain position.
Definition: lanefollowinggeometry.h:722
double getViewingDistance() const
Get the viewing distance.
Definition: lanefollowinggeometry.h:615
void update(BorderSet *borderSet, BorderTrace *borderTrace, BorderCostMap *borderCost, Border *start, adore::env::VehicleMotionState9d *ego, double lookahead_distance, double lookbehind_distance, double smoothness=0.05, bool activate_navigation=false)
update the road geometry
Definition: lanefollowinggeometry.h:123
double getHeading(double s)
Get the heading at a certain position.
Definition: lanefollowinggeometry.h:711
BorderAccumulator * getLeftBorders()
Get the left borders of the LaneFollowingGeometry.
Definition: lanefollowinggeometry.h:555
double m_s_lane_width_closed
Definition: lanefollowinggeometry.h:73
BorderAccumulator * getRightBorders()
Get the right borders of the LaneFollowingGeometry.
Definition: lanefollowinggeometry.h:546
double getOffsetOfRightBorder(double s)
Get the offset of the right border at a certain position.
Definition: lanefollowinggeometry.h:742
void toEucledianCoordinates(double s, double n, double &Xg, double &Yg, double &Zg)
Transform from relative to euclidian coordinates.
Definition: lanefollowinggeometry.h:787
bool isValid() const
Check whether the LaneFollowingGeometry is valid.
Definition: lanefollowinggeometry.h:606
double getCurvature(double s, int derivative)
Get the curvature of the lane at a certain position.
Definition: lanefollowinggeometry.h:671
LaneFollowingview provides traffic related information for the current lane.
Definition: lanefollowingview.h:42
virtual double getCurvature(double s, int derivative) override
Definition: lanefollowingview.h:193
LocalRoadMap * lrm_
Definition: lanefollowingview.h:47
virtual const adore::view::TrafficQueue & getOnLaneTraffic() const override
Definition: lanefollowingview.h:140
virtual double getOffsetOfLeftBorder(double s) override
Definition: lanefollowingview.h:201
virtual double getSMax() const override
Definition: lanefollowingview.h:112
TLaneFollowingGeometry * getGeometry()
Definition: lanefollowingview.h:105
virtual double getSpeedLimit(double s) override
Definition: lanefollowingview.h:157
virtual double getHeading(double s) override
Definition: lanefollowingview.h:186
virtual double getSMin() const override
Definition: lanefollowingview.h:116
virtual double getRightIndicatorHint(double s) override
Definition: lanefollowingview.h:163
LocalRoadMap * getLocalRoadMap()
Definition: lanefollowingview.h:96
LaneFollowingView(adore::params::AFactory *paramsfactory, LocalRoadMap *localRoadMap, adore::env::traffic::TrafficMap *trafficMap)
Construct a new LaneFollowingView object.
Definition: lanefollowingview.h:62
virtual void boundNavigationCost(double s0, double s1, double &cmin, double &cmax) override
Definition: lanefollowingview.h:177
virtual double getOffsetOfRightBorder(double s) override
Definition: lanefollowingview.h:209
std::vector< Border * > * get_right_borders_of_conf_lanes()
Definition: lanefollowingview.h:234
void update()
update the LaneFollowingView
Definition: lanefollowingview.h:87
virtual const adore::view::ConflictSet & getConflictSet() const override
Definition: lanefollowingview.h:148
virtual double getLeftIndicatorHint(double s) override
Definition: lanefollowingview.h:160
void getBordersToPrint(std::vector< Border * > &result, std::vector< int > &ids)
Definition: lanefollowingview.h:99
adore::env::traffic::EgoLaneTraffic elt_
Definition: lanefollowingview.h:50
virtual double getSpeedRecommendation(double s) const override
Definition: lanefollowingview.h:174
virtual double getNavigationCost(double s) override
Definition: lanefollowingview.h:176
adore::params::APLaneFollowingView * apLFV_
Definition: lanefollowingview.h:49
std::unordered_multimap< view::ConflictZone *, std::vector< Border * > > * getConflictSetPlotData()
Definition: lanefollowingview.h:78
std::vector< BorderOverlapSet > * getOverlapSet()
Definition: lanefollowingview.h:233
virtual void toEucledianCoordinates(double s, double n, double &xe, double &ye, double &ze) override
Definition: lanefollowingview.h:226
TLaneFollowingGeometry lfg_
Definition: lanefollowingview.h:48
virtual bool isValid() const override
Definition: lanefollowingview.h:111
LaneFollowingGeometry< 20, 200 > TLaneFollowingGeometry
Definition: lanefollowingview.h:44
virtual double getProgressOfWidthOpen() const override
Definition: lanefollowingview.h:124
virtual bool hasSpeedRecommendation(double s) const override
Definition: lanefollowingview.h:169
adore::env::BorderBased::ConflictSet cs_
Definition: lanefollowingview.h:51
virtual void toRelativeCoordinates(double xe, double ye, double &s, double &n) override
Definition: lanefollowingview.h:217
LaneFollowingView(LocalRoadMap *localRoadMap, adore::env::traffic::TrafficMap *trafficMap)
Definition: lanefollowingview.h:70
virtual double getProgressOfWidthClosed() const override
Definition: lanefollowingview.h:132
std::vector< Coordinate > * getCornerPoints()
Definition: lanefollowingview.h:232
Definition: localroadmap.h:38
BorderTrace * getBorderTrace()
Get the BorderTrace.
Definition: localroadmap.h:154
bool isNavigationActive()
transfers value of APLocalRoadMap->isNavigationActive is true
Definition: localroadmap.h:181
PrecedenceSet * getPrecedenceSet()
Get the PrecedenceSet object.
Definition: localroadmap.h:132
Border * getMatchedBorder()
Get the matched border.
Definition: localroadmap.h:163
BorderCostMap * getBorderCostMap()
Get the BorderCostMap object.
Definition: localroadmap.h:172
BorderSet * getBorderSet()
Get the BorderSet object.
Definition: localroadmap.h:123
VehicleMotionState9d * getVehicleState()
Get the VehicleState.
Definition: localroadmap.h:141
Definition: egolanetraffic.h:34
const adore::view::TrafficQueue & getQueue() const
Get the traffic queue.
Definition: egolanetraffic.h:50
void mapVehiclesOnBorders(adore::view::ALane *lfv, const adore::env::BorderBased::BorderSubSet &borders)
Map vehicles on borders.
Definition: egolanetraffic.h:69
Definition: trafficmap.h:36
abstract factory for adore::params classes
Definition: afactory.h:54
virtual APLaneFollowingView * getLaneFollowingView() const =0
abstract class containing parameters for a lane following view
Definition: ap_lane_following_view.h:25
virtual double getLookBehind() const =0
virtual double getLookAhead() const =0
virtual double getBaselineFitSmoothness() const =0
Definition: alane.h:28
Definition: conflictset.h:176
std::vector< TrafficObject > TrafficQueue
Definition: trafficobject.h:183
Definition: areaofeffectconverter.h:20