ADORe
ADORe is a modular open source software library and toolkit for decision making, planning, control and simulation of automated vehicles
plot_views.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  * Matthias Nichting - initial implementation
13  ********************************************************************************/
14 
15 #pragma once
18 #include <plotlablib/afigurestub.h>
20 
21 namespace adore
22 {
23  namespace apps
24  {
29  class PlotViews
30  {
31  private:
33  std::string prefix_;
36 
37  public:
38  PlotViews(DLR_TS::PlotLab::AFigureStub* figure, std::string prefix,
39  const adore::PLOT::ViewPlotterConfig& config)
40  : figure_(figure), prefix_(prefix), config_(config)
41  {
42  figure_->erase_similar(prefix_); // erase plots made by another instance of ViewPlotter
43  }
44 
46  {
47  }
48 
49  void run()
50  {
51  tlvd_.update();
52  if (tlvd_.getCurrentLane()->isValid())
53  {
55  {
56  std::string prefix = prefix_;
57  prefix.append("lfg");
59  }
60 
62  {
63  std::string prefix = prefix_;
64  prefix.append("lcl");
66  {
68  }
69  else
70  {
71  figure_->erase_similar(prefix);
72  }
73  }
74 
76  {
77  std::string prefix = prefix_;
78  prefix.append("lcr");
80  {
82  }
83  else
84  {
85  figure_->erase_similar(prefix);
86  }
87  }
88 
89  // if (laneChangeViewLeftReader_->hasUpdate() && config_.plot_lc_geometry)
90  // {
91  // std::string prefix = prefix_;
92  // prefix.append("lcl");
93  // auto alanechangeview = new adore::view::ALaneChangeView();
94  // laneChangeViewLeftReader_->getData(*alanechangeview);
95  // if (alanechangeview->isValid())
96  // {
97  // adore::PLOT::plotALaneChangeView(*alanechangeview->getTargetLane(), prefix, config_,
98  // figure_);
99  // }
100  // else
101  // {
102  // figure_->erase_similar(prefix);
103  // }
104  // }
105  }
106  else
107  {
109  }
110  }
111  };
112  } // namespace apps
113 } // namespace adore
Definition: afigurestub.h:24
virtual void erase_similar(std::string hashtag)=0
Definition: viewplotter_config.h:23
bool plot_lf_geometry
Definition: viewplotter_config.h:32
bool plot_lc_geometry
Definition: viewplotter_config.h:33
a plotting application to plot the folling: lanefollowinggeometry, lanechangegeometry
Definition: plot_views.h:30
PlotViews(DLR_TS::PlotLab::AFigureStub *figure, std::string prefix, const adore::PLOT::ViewPlotterConfig &config)
Definition: plot_views.h:38
adore::PLOT::ViewPlotterConfig config_
Definition: plot_views.h:34
env::ThreeLaneViewDecoupled tlvd_
Definition: plot_views.h:35
~PlotViews()
Definition: plot_views.h:45
void run()
Definition: plot_views.h:49
DLR_TS::PlotLab::AFigureStub * figure_
Definition: plot_views.h:32
std::string prefix_
Definition: plot_views.h:33
Definition: threelaneviewdecoupled.h:32
virtual adore::view::ALaneChangeView * getLeftLaneChange()
Definition: threelaneviewdecoupled.h:412
virtual adore::view::ALaneChangeView * getRightLaneChange()
Definition: threelaneviewdecoupled.h:419
virtual adore::view::ALane * getCurrentLane()
Definition: threelaneviewdecoupled.h:405
void update()
Definition: threelaneviewdecoupled.h:373
virtual ALane * getTargetLane()=0
virtual bool isValid() const =0
void plotALane(adore::view::ALane *alane, std::string tag, adore::PLOT::ViewPlotterConfig config, DLR_TS::PlotLab::AFigureStub *figure, std::string viewtype)
Definition: plot_views.h:26
void plotALaneChangeView(adore::view::ALaneChangeView *alanechangeview, std::string tag, adore::PLOT::ViewPlotterConfig config, DLR_TS::PlotLab::AFigureStub *figure)
Definition: plot_views.h:68
Definition: areaofeffectconverter.h:20