ADORe
ADORe is a modular open source software library and toolkit for decision making, planning, control and simulation of automated vehicles
laneposition.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 API and implementation
13  ********************************************************************************/
14 
15 
16 #pragma once
18 
19 namespace adore
20 {
21  namespace env
22  {
23  namespace BorderBased
24  {
29  struct LanePosition
30  {
32  double m_progress;
44  LanePosition(const BorderID& id, double progress)
45  {
46  m_rightID = BorderID(id);
47  m_progress = progress;
48  }
55  {
57  m_progress = pos.m_progress;
58  }
66  void translate(double dx,double dy,double dz)
67  {
68  m_rightID.translate(dx,dy,dz);
69  }
70  void rotate(double angle, double x0=0, double y0=0)
71  {
72  m_rightID.rotate(angle, x0, y0);
73  }
81  bool operator==(const LanePosition& other)const
82  {
83  return this->m_progress == other.m_progress &&
84  this->m_rightID.m_first == other.m_rightID.m_first &&
85  this->m_rightID.m_last == other.m_rightID.m_last;
86  }
92  std::string toString() const
93  {
94  std::stringstream s;
95  s<<m_rightID.toString()<<"@"<<std::setprecision(3)<<m_progress;
96  return s.str();
97  }
98  };
100  {
101  std::size_t operator()(const LanePosition& c) const
102  {
103  using::std::hash;
104  using::std::size_t;
105 
106  BorderIDHasher BIDhasher;
107  size_t hasherBID = BIDhasher(c.m_rightID);
108 
109  return (hash<double>()(c.m_progress) ^ hasherBID);
110  }
111 
112  std::size_t operator()(const LanePosition* c) const
113  {
114  using::std::hash;
115  using::std::size_t;
116 
117  BorderIDHasher BIDhasher;
118  size_t hasherBID = BIDhasher(c->m_rightID);
119 
120  return (hash<double>()(c->m_progress) ^ hasherBID);
121  }
122  };
123  }
124  }
125 }
x0
Definition: adore_set_goal.py:25
y0
Definition: adore_set_goal.py:26
Definition: areaofeffectconverter.h:20
a functor, which hashes a BorderID object -> std::unordered_set<BorderID,BorderIDHasher> amap(0);
Definition: borderid.h:176
This struct identifies a Border by the coordinates of the starting and the end point.
Definition: borderid.h:31
Coordinate m_last
Definition: borderid.h:32
Coordinate m_first
Definition: borderid.h:32
std::string toString() const
Write information of the BorderID to a string.
Definition: borderid.h:131
void translate(double dx, double dy, double dz)
Translate a border.
Definition: borderid.h:42
void rotate(double angle, double x0=0.0, double y0=0.0)
Definition: borderid.h:78
Definition: laneposition.h:100
std::size_t operator()(const LanePosition &c) const
Definition: laneposition.h:101
std::size_t operator()(const LanePosition *c) const
Definition: laneposition.h:112
This is a struct that contains a position defined by a BorderID and a progress on that border.
Definition: laneposition.h:30
bool operator==(const LanePosition &other) const
Check two LanePositions for equality.
Definition: laneposition.h:81
void translate(double dx, double dy, double dz)
Translate the LanePosition by translating the BorderID.
Definition: laneposition.h:66
std::string toString() const
Extract the information of the LanePosition to a string.
Definition: laneposition.h:92
double m_progress
Definition: laneposition.h:32
BorderID m_rightID
Definition: laneposition.h:31
void rotate(double angle, double x0=0, double y0=0)
Definition: laneposition.h:70
LanePosition(const LanePosition &pos)
Construct a new LanePosition.
Definition: laneposition.h:54
LanePosition()
Construct a new LanePosition object.
Definition: laneposition.h:37
LanePosition(const BorderID &id, double progress)
Construct a new LanePosition.
Definition: laneposition.h:44