ADORe
ADORe is a modular open source software library and toolkit for decision making, planning, control and simulation of automated vehicles
plot_predictions.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 implementation
13  * Thomas Lobig
14  ********************************************************************************/
15 
16 #pragma once
20 #include <adore/env/afactory.h>
21 #include <plotlablib/afigurestub.h>
22 #include <plotlablib/plcommands.h>
23 #include <unordered_set>
24 #include <string>
25 
26 
27 namespace adore
28 {
29  namespace apps
30  {
36  {
37  private:
39 
40  std::unordered_set<std::string> plot_tags_old_worstcase_;
41  std::unordered_set<std::string> plot_tags_current_worstcase_;
42 
43  std::unordered_set<std::string> plot_tags_old_expected_;
44  std::unordered_set<std::string> plot_tags_current_expected_;
45 
46  std::unordered_set<std::string> plot_tags_old_desired_;
47  std::unordered_set<std::string> plot_tags_current_desired_;
48 
49  std::unordered_set<std::string> plot_tags_old_static_;
50  std::unordered_set<std::string> plot_tags_current_static_;
51 
53  unsigned long long counter_;
55  std::string prefix_;
56 
61 
66 
69  double fov_width_;
70  double fov_height_;
71  // int urlPreset_;
72  double t_;
74 
76 
77  public:
78  // FancyBird(DLR_TS::PlotLab::AFigureStub* figure,adore::params::APVehicle* pvehicle, adore::params::APMapProvider* pmap,std::string prefix,const adore::PLOT::FancyBirdConfig & config, const adore::PLOT::GeoTilesConfig geoTiles_config)
80  {
81  counter_=0;
83  figure_ = figure;
84  prefix_ = prefix;
85  t_ = 0;
86  t_prediction_max_ = config_.t_prediction_max; // TODO: reconsidder where to get this max from, currently a plot property
87  fov_width_ = 640.0;
88  fov_height_ = 480.0;
89  config_ = config;
90 
95  }
96 
98  {
99  // geoTiles_->~GeoTiles();
100  }
101 
102  void run()
103  {
104 
106  {
108  t_ = position_.getTime();
109  }
110 
111  /* Worst Case Prediction Feed */
113  {
116 
117  std::stringstream tag;
118  tag << prefix_ << "/wcp";
121 
122  for(auto s:plot_tags_old_worstcase_)
123  {
125  {
126  figure_->erase(s);
127  }
128  }
129  }
130 
131  // /* Expected Prediction Feed */
133  {
136 
137  std::stringstream tag;
138  tag << prefix_ << "/ecp";
141 
142  for(auto s:plot_tags_old_expected_)
143  {
145  {
146  figure_->erase(s);
147  }
148  }
149  }
150 
151  // /* Desired Prediction Feed */
153  {
156 
157  std::stringstream tag;
158  tag << prefix_ << "/dcp";
161 
162  for(auto s:plot_tags_old_desired_)
163  {
165  {
166  figure_->erase(s);
167  }
168  }
169  }
170 
171  // /* static obstacles Feed */
173  {
176 
177  std::stringstream tag;
178  tag << prefix_ << "/sop";
181 
182  for(auto s:plot_tags_old_static_)
183  {
185  {
186  figure_->erase(s);
187  }
188  }
189  }
190 
191  }
192 
193 
194  };
195  }
196 }
Definition: afigurestub.h:24
virtual void erase(std::string hashtag)=0
Definition: prediction_config.h:24
prediction_config static_
Definition: prediction_config.h:74
prediction_config expected_
Definition: prediction_config.h:71
prediction_config desired_
Definition: prediction_config.h:70
prediction_config worst_case_
Definition: prediction_config.h:72
double t_prediction_max
Definition: prediction_config.h:76
a plot module for handling prediction plots
Definition: plot_predictions.h:36
adore::env::OccupancyCylinderPredictionSet desired_predictions_
Definition: plot_predictions.h:59
std::unordered_set< std::string > plot_tags_current_worstcase_
Definition: plot_predictions.h:41
int plotCount_
Definition: plot_predictions.h:67
adore::env::OccupancyCylinderPredictionSet expected_predictions_
Definition: plot_predictions.h:58
adore::mad::AReader< adore::env::VehicleMotionState9d > * positionReader_
Definition: plot_predictions.h:38
std::unordered_set< std::string > plot_tags_old_expected_
Definition: plot_predictions.h:43
std::unordered_set< std::string > plot_tags_old_desired_
Definition: plot_predictions.h:46
DLR_TS::PlotLab::AFigureStub * figure_
Definition: plot_predictions.h:52
int eraseCount_
Definition: plot_predictions.h:68
double fov_width_
Definition: plot_predictions.h:69
std::unordered_set< std::string > plot_tags_current_desired_
Definition: plot_predictions.h:47
double fov_height_
Definition: plot_predictions.h:70
adore::env::OccupancyCylinderPredictionSet static_obstacles_
Definition: plot_predictions.h:60
double t_prediction_max_
Definition: plot_predictions.h:73
adore::env::AFactory::TOCPredictionSetReader * staticObstaclesReader_
Definition: plot_predictions.h:65
adore::env::AFactory::TOCPredictionSetReader * expected_prediction_reader_
Definition: plot_predictions.h:64
PlotPredictions(DLR_TS::PlotLab::AFigureStub *figure, std::string prefix, const adore::PLOT::PredictionConfig &config)
Definition: plot_predictions.h:79
unsigned long long counter_
Definition: plot_predictions.h:53
double t_
Definition: plot_predictions.h:72
std::unordered_set< std::string > plot_tags_current_expected_
Definition: plot_predictions.h:44
std::string prefix_
Definition: plot_predictions.h:55
~PlotPredictions()
Definition: plot_predictions.h:97
void run()
Definition: plot_predictions.h:102
std::unordered_set< std::string > plot_tags_old_static_
Definition: plot_predictions.h:49
adore::env::VehicleMotionState9d position_
Definition: plot_predictions.h:54
adore::env::AFactory::TOCPredictionSetReader * desired_prediction_reader_
Definition: plot_predictions.h:63
std::unordered_set< std::string > plot_tags_current_static_
Definition: plot_predictions.h:50
adore::env::OccupancyCylinderPredictionSet worst_case_predictions_
Definition: plot_predictions.h:57
adore::env::AFactory::TOCPredictionSetReader * worst_case_prediction_reader_
Definition: plot_predictions.h:62
adore::PLOT::PredictionConfig config_
Definition: plot_predictions.h:75
std::unordered_set< std::string > plot_tags_old_worstcase_
Definition: plot_predictions.h:40
virtual TOCPredictionSetReader * getExpectedPredictionSetReader()=0
virtual TOCPredictionSetReader * getStaticObstaclesPredictionSetReader()=0
virtual TVehicleMotionStateReader * getVehicleMotionStateReader()=0
virtual TOCPredictionSetReader * getWorstCasePredictionSetReader()=0
virtual TOCPredictionSetReader * getDesiredPredictionSetReader()=0
static adore::env::AFactory * get()
Definition: afactory.h:236
virtual void getData(T &value)=0
virtual bool hasUpdate() const =0
void plotPredictionSet(adore::env::OccupancyCylinderPredictionSet set, double t, double t_max, PLOT::PredictionConfig::prediction_config config, std::string subtopic, DLR_TS::PlotLab::AFigureStub *figure, std::unordered_set< std::string > &plot_tags)
Definition: plot_prediction.h:191
std::vector< OccupancyCylinderPrediction > OccupancyCylinderPredictionSet
Definition: occupancycylinderprediction.h:40
Definition: areaofeffectconverter.h:20
bool active_
Definition: prediction_config.h:47
This struct holds the motion state of the vehicle in 9d.
Definition: vehiclemotionstate9d.h:39
double getTime() const
Get the time.
Definition: vehiclemotionstate9d.h:48