ADORe
ADORe is a modular open source software library and toolkit for decision making, planning, control and simulation of automated vehicles
map_parkingspot_management.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  ********************************************************************************/
13 
14 
15 #pragma once
16 
18 #include "map_auxiliary.h"
19 
20 namespace adore
21 {
22  namespace env
23  {
29  {
32 
33  public:
40  {
41  m_globalSet = globalSet;
42  }
43 
48  void reset()
49  {
50  m_localSet.clear();
51  }
52 
63  void run(double x, double y, double r, std::vector<adore::env::BorderBased::ParkingSpot> &newSpots, std::vector<adore::env::BorderBased::ParkingSpot> &outdatedSpots, int MAX_SEND_NUMBER = 5)
64  {
65  auto corners = MAP_AUX::getCornerPoints(x,y,r);
66 
67  newSpots.clear();
68  outdatedSpots.clear();
69 
70  /* collect ParkingSpots that will be removed */
71  outdatedSpots = m_localSet.itPair2ParkingSpotVector(m_localSet.getParkingSpotsOutsideRegion(corners.at(0),corners.at(1),corners.at(2),corners.at(3)));
72  for(auto it = outdatedSpots.begin(); it!=outdatedSpots.end(); it++)
73  {
75  }
76 
77  /* collect new ParkingSpots */
78  int newCount = 0;
79  for(auto visible = m_globalSet.getParkingSpotsInRegion(corners.at(0),corners.at(1),corners.at(2),corners.at(3)); visible.first!=visible.second; visible.first++)
80  {
81  adore::env::BorderBased::ParkingSpot ps(adore::env::BorderBased::Coordinate(visible.first->first),visible.first->second);
82  if(!m_localSet.hasParkingSpot(ps))
83  {
85  newSpots.push_back(ps);
86  newCount++;
87  if(newCount>=MAX_SEND_NUMBER)
88  {
89  break;
90  }
91  }
92  }
93 
94 
95  }
96  };
97  }
98 }
Definition: parkingspotset.h:39
void clear()
Definition: parkingspotset.h:172
bool insertParkingSpot(ParkingSpot parkingSpot)
Definition: parkingspotset.h:135
ItPairCoordinate2heading getParkingSpotsOutsideRegion(double x0, double x1, double y0, double y1)
Definition: parkingspotset.h:206
bool eraseParkingSpot(adore::env::BorderBased::Coordinate::boost_point bp)
Definition: parkingspotset.h:98
std::vector< ParkingSpot > itPair2ParkingSpotVector(ItPairCoordinate2heading itPair)
Definition: parkingspotset.h:245
ItPairCoordinate2heading getParkingSpotsInRegion(double x0, double x1, double y0, double y1)
Definition: parkingspotset.h:192
bool hasParkingSpot(adore::env::BorderBased::Coordinate::boost_point bp)
Definition: parkingspotset.h:84
This class definition is to represent parking spots.
Definition: parkingspot.h:31
automatically manage parking spot based on current vehicle position and last state of object
Definition: map_parkingspot_management.h:29
void run(double x, double y, double r, std::vector< adore::env::BorderBased::ParkingSpot > &newSpots, std::vector< adore::env::BorderBased::ParkingSpot > &outdatedSpots, int MAX_SEND_NUMBER=5)
get new and outdated parking spots based on vehicle position
Definition: map_parkingspot_management.h:63
adore::env::BorderBased::ParkingSpotSet m_localSet
Definition: map_parkingspot_management.h:31
void init(adore::env::BorderBased::ParkingSpotSet &globalSet)
initialization routine with global parking spot set
Definition: map_parkingspot_management.h:39
adore::env::BorderBased::ParkingSpotSet m_globalSet
Definition: map_parkingspot_management.h:30
void reset()
clear the local set
Definition: map_parkingspot_management.h:48
std::vector< double > getCornerPoints(double x, double y, double r)
Get corner points vector from center point and radius.
Definition: map_auxiliary.h:34
x
Definition: adore_set_goal.py:30
y
Definition: adore_set_goal.py:31
r
Definition: adore_suppress_lanechanges.py:209
Definition: areaofeffectconverter.h:20
This struct represents 3-dimensional coordines.
Definition: coordinate.h:34
T1 first
Definition: parkingspotset.h:47