ADORe
ADORe is a modular open source software library and toolkit for decision making, planning, control and simulation of automated vehicles
platoon_view_provider.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  * Reza Dariani - computation of platoon view in separate app
13  ********************************************************************************/
14 
15 #pragma once
16 
17 #include <adore/env/afactory.h>
18 #include <adore/params/afactory.h>
19 #include <adore/fun/afactory.h>
29 #include <vector>
30 
31 
32 namespace adore
33 {
34  namespace apps
35  {
41  {
42  private:
43 
48 
49  //std::vector<adore::env::CooperativeUserPrediction> cooperativeUserPredictionList;
55  std::vector<int> index;
56 
57 
58 
59 
60  public:
61  PlatoonViewProvider() :connectionSet_(adore::env::EnvFactoryInstance::get()->getControlledConnectionFeed() )
62  {
63 
68 
69 
70  }
72  {
73  delete xreader_;
74  }
75 
76 
81  void run()
82  {
83 
86  }
87 
88 
89  private:
90 
91 
92 
95 
96  int getIndex(std::vector<int> v, int K)
97  {
98  auto it = find(v.begin(), v.end(), K);
99  if (it != v.end())
100  {
101 
102  return (it - v.begin());
103  }
104  else {return -1; }
105  }
106 
108  {
109  int ind = -1;
110  //localCooperativeUserList.clear();
112 
113 
115  {
117 
119  {
120 
121  if(localCooperativeUserList.empty() )
122  {
123 
125  index.push_back(cooperativeUser.id);
126 
127  }
128  else
129  {
130 
132  if(ind == -1)
133  {
134 
136  index.push_back(cooperativeUser.id);
137  }
138  else
139  {
140 
142  }
143 
144  }
145 
146  }
147  //
148 
149  }
150  std::cout<<"\n"<<localCooperativeUserList.size()<<" cooperative object[s] is[are] listed";
151  for(int i=0; i<localCooperativeUserList.size(); i++) std::cout<<"\nID: "<<localCooperativeUserList[i].id;
152  //
153 
154  //localCooperativeUserList
155  }
156 
157 
158 
159  };
160  } // namespace apps
161 } // namespace adore
Definition: platoon_view_provider.h:41
void run()
update data, views and recompute maneuver
Definition: platoon_view_provider.h:81
void readCooperativeUser()
Definition: platoon_view_provider.h:107
adore::env::ThreeLaneViewDecoupled three_lanes_
Definition: platoon_view_provider.h:52
virtual ~PlatoonViewProvider()
Definition: platoon_view_provider.h:71
adore::mad::AReader< adore::env::CooperativeUserPrediction > * cooperativeUserPrediction_reader
Definition: platoon_view_provider.h:44
std::vector< int > index
Definition: platoon_view_provider.h:55
int getIndex(std::vector< int > v, int K)
Definition: platoon_view_provider.h:96
adore::env::ControlledConnectionSet connectionSet_
Definition: platoon_view_provider.h:54
int automationLevel
Definition: platoon_view_provider.h:94
PlatoonViewProvider()
Definition: platoon_view_provider.h:61
adore::mad::AReader< adore::fun::VehicleMotionState9d > * xreader_
Definition: platoon_view_provider.h:50
adore::mad::AWriter< adore::env::CooperativeUsersList > * cooperativeUserList_writer
Definition: platoon_view_provider.h:45
adore::env::ConnectionsOnLane * connectionsOnLane_
Definition: platoon_view_provider.h:53
bool vehiclePlatooningCapability
Definition: platoon_view_provider.h:93
adore::fun::VehicleMotionState9d x_
Definition: platoon_view_provider.h:51
adore::env::CooperativeUsersList localCooperativeUserList
Definition: platoon_view_provider.h:47
adore::env::CooperativeUserPrediction cooperativeUser
Definition: platoon_view_provider.h:46
virtual CooperativeUsersListWriter * getCooperativeUsersListWriter()=0
virtual TVehicleMotionStateReader * getVehicleMotionStateReader()=0
virtual CooperativeUserReader * getCooperativeUserReader()=0
Definition: connectionsonlane.h:33
Definition: controlledconnection.h:147
static adore::env::AFactory * get()
Definition: afactory.h:236
Definition: threelaneviewdecoupled.h:32
virtual adore::view::ALane * getCurrentLane()
Definition: threelaneviewdecoupled.h:405
static adore::fun::AFactory * get()
Definition: afactory.h:170
virtual void getData(T &value)=0
virtual bool hasData() const =0
virtual void write(const T &value)=0
std::vector< CooperativeUserPrediction > CooperativeUsersList
Definition: cooperativeusersprediction.h:70
Definition: areaofeffectconverter.h:20
Definition: cooperativeusersprediction.h:24
int lane_position
Definition: cooperativeusersprediction.h:31
int id
Definition: cooperativeusersprediction.h:27
void clear()
Definition: cooperativeusersprediction.h:52
This struct holds the motion state of the vehicle in 9d.
Definition: vehiclemotionstate9d.h:39