ADORe
ADORe is a modular open source software library and toolkit for decision making, planning, control and simulation of automated vehicles
plot_conflict_set.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_;
41  std::unordered_set<std::string> plot_tags_current_;
42 
44  unsigned long long counter_;
46  std::string prefix_;
47 
49 
50  double t_;
52 
54 
55 
56  public:
57  PlotConflicts(DLR_TS::PlotLab::AFigureStub* figure,std::string prefix)
58  {
59  counter_=0;
61  figure_ = figure;
62  prefix_ = prefix;
63  t_ = 0;
64  t_prediction_max_ = 10.0; // TODO: reconsidder where to get this max from, currently a plot property
65  config_.active_ = true;
66  config_.r_.start_ = 1.0;
67  config_.r_.end_ = 0.0;
68  config_.g_.start_ = 0.0;
69  config_.g_.end_ = 1.0;
70  config_.b_.start_ = 0.0;
71  config_.b_.end_ = 0.0;
72 
74  }
75 
77  {
78  delete positionReader_;
79  delete conflict_set_reader_;
80  }
81 
82  void run()
83  {
84 
86  {
88  t_ = position_.getTime();
89  }
90 
92  {
94  plot_tags_current_.clear();
95 
96  std::stringstream tag;
97  tag << prefix_ << "/conflict";
99  conflict_set_reader_->getData(conflict_set);
101 
102  for(auto s:plot_tags_old_)
103  {
104  if(plot_tags_current_.find(s)==plot_tags_current_.end())
105  {
106  figure_->erase(s);
107  }
108  }
109  }
110 
111 
112  }
113 
114 
115  };
116  }
117 }
Definition: afigurestub.h:24
virtual void erase(std::string hashtag)=0
a plot module for handling prediction plots
Definition: plot_conflict_set.h:36
std::unordered_set< std::string > plot_tags_old_
Definition: plot_conflict_set.h:40
void run()
Definition: plot_conflict_set.h:82
adore::mad::AReader< adore::env::VehicleMotionState9d > * positionReader_
Definition: plot_conflict_set.h:38
PlotConflicts(DLR_TS::PlotLab::AFigureStub *figure, std::string prefix)
Definition: plot_conflict_set.h:57
double t_prediction_max_
Definition: plot_conflict_set.h:51
std::unordered_set< std::string > plot_tags_current_
Definition: plot_conflict_set.h:41
unsigned long long counter_
Definition: plot_conflict_set.h:44
~PlotConflicts()
Definition: plot_conflict_set.h:76
std::string prefix_
Definition: plot_conflict_set.h:46
DLR_TS::PlotLab::AFigureStub * figure_
Definition: plot_conflict_set.h:43
adore::env::AFactory::TOCPredictionSetReader * conflict_set_reader_
Definition: plot_conflict_set.h:48
adore::env::VehicleMotionState9d position_
Definition: plot_conflict_set.h:45
adore::PLOT::PredictionConfig::prediction_config config_
Definition: plot_conflict_set.h:53
double t_
Definition: plot_conflict_set.h:50
virtual TVehicleMotionStateReader * getVehicleMotionStateReader()=0
virtual TOCPredictionSetReader * getConflictSetReader()=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
double start_
Definition: prediction_config.h:30
double end_
Definition: prediction_config.h:31
Definition: prediction_config.h:27
bool active_
Definition: prediction_config.h:47
color_range b_
Definition: prediction_config.h:46
color_range g_
Definition: prediction_config.h:46
color_range r_
Definition: prediction_config.h:46
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