ADORe
ADORe is a modular open source software library and toolkit for decision making, planning, control and simulation of automated vehicles
decoupledtrafficpredictionview.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  ********************************************************************************/
14 
15 #pragma once
17 #include <adore/env/afactory.h>
18 
19 namespace adore
20 {
21  namespace env
22  {
24  {
25  private:
32 
33  public:
35  {
36  expectedReader_ = factory->getExpectedPredictionSetReader();
37  emergencyReader_ = factory->getWorstCasePredictionSetReader();
38  staticObstaclesReader_ = factory->getStaticObstaclesPredictionSetReader();
39  }
43  void update()
44  {
45  expected_predictions_.clear();
47  emergency_predictions_.clear();
49  static_obstacles_.clear();
51  }
55  virtual bool overlapsExpectedBehavior(const adore::mad::OccupancyCylinderTree& space)const override
56  {
57  for(const auto& prediction:expected_predictions_)
58  {
59  if(prediction.occupancy_.collidesWith(space))
60  {
61  return true;
62  }
63  }
64  for(const auto& prediction:static_obstacles_)
65  {
66  if(prediction.occupancy_.collidesWith(space))
67  {
68  return true;
69  }
70  }
71  return false;
72  }
76  virtual bool overlapsEmergencyBehavior(const adore::mad::OccupancyCylinderTree& space)const override
77  {
78  for(const auto& prediction:emergency_predictions_)
79  {
80  if(prediction.occupancy_.collidesWith(space))
81  {
82  return true;
83  }
84  }
85  for(const auto& prediction:static_obstacles_)
86  {
87  if(prediction.occupancy_.collidesWith(space))
88  {
89  return true;
90  }
91  }
92  return false;
93  }
97  virtual double getExpectedCollisionTime(const adore::mad::OccupancyCylinderTree& space,double guard)const override
98  {
99  double min_value = guard;
100  double value;
101  for(const auto& prediction:expected_predictions_)
102  {
103  if(prediction.occupancy_.getEarliestCollisionTime(space,min_value,value))
104  {
105  min_value = std::min(value,min_value);
106  }
107  }
108  for(const auto& prediction:static_obstacles_)
109  {
110  if(prediction.occupancy_.getEarliestCollisionTime(space,min_value,value))
111  {
112  min_value = std::min(value,min_value);
113  }
114  }
115  return min_value;
116  }
117  };
118  }
119 }
abstract factory for adore::env communication
Definition: afactory.h:41
Definition: decoupledtrafficpredictionview.h:24
OccupancyCylinderPredictionSet emergency_predictions_
Definition: decoupledtrafficpredictionview.h:30
virtual double getExpectedCollisionTime(const adore::mad::OccupancyCylinderTree &space, double guard) const override
Definition: decoupledtrafficpredictionview.h:97
virtual bool overlapsExpectedBehavior(const adore::mad::OccupancyCylinderTree &space) const override
Definition: decoupledtrafficpredictionview.h:55
DecoupledTrafficPredictionView(AFactory *factory=EnvFactoryInstance::get())
Definition: decoupledtrafficpredictionview.h:34
AFactory::TOCPredictionSetReader * expectedReader_
Definition: decoupledtrafficpredictionview.h:26
AFactory::TOCPredictionSetReader * emergencyReader_
Definition: decoupledtrafficpredictionview.h:27
OccupancyCylinderPredictionSet expected_predictions_
Definition: decoupledtrafficpredictionview.h:29
OccupancyCylinderPredictionSet static_obstacles_
Definition: decoupledtrafficpredictionview.h:31
AFactory::TOCPredictionSetReader * staticObstaclesReader_
Definition: decoupledtrafficpredictionview.h:28
virtual bool overlapsEmergencyBehavior(const adore::mad::OccupancyCylinderTree &space) const override
Definition: decoupledtrafficpredictionview.h:76
void update()
Definition: decoupledtrafficpredictionview.h:43
static adore::env::AFactory * get()
Definition: afactory.h:236
Definition: com_patterns.h:68
virtual void getData(T &value)=0
Definition: occupancycylinder.h:84
Definition: atrafficpredictionview.h:27
std::vector< OccupancyCylinderPrediction > OccupancyCylinderPredictionSet
Definition: occupancycylinderprediction.h:40
T min(T a, T b, T c, T d)
Definition: adoremath.h:663
Definition: areaofeffectconverter.h:20