ADORe
ADORe is a modular open source software library and toolkit for decision making, planning, control and simulation of automated vehicles
trafficcontroldevice.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  * Stephan Lapoehn - initial implementation and API
13  ********************************************************************************/
14 
15 #pragma once
16 
18 
19 namespace adore
20 {
21  namespace env
22  {
24  {
25  public:
26 
27  enum TCDType
28  {
32  STOP_SIGN = 3,
48  UNKNOWN = 99
49  };
50 
51  enum TCDClass
52  {
56  C_UNKNOWN = 99
57  };
58 
64  {
65  switch(type_)
66  {
67  case TRAFFIC_LIGHT:
69  return C_TRAFFIC_LIGHT;
70  case RIGHT_OF_WAY:
71  case STOP_SIGN:
72  return C_PRECEDENCE;
73  case SPEED_LIMIT_10:
74  case SPEED_LIMIT_20:
75  case SPEED_LIMIT_30:
76  case SPEED_LIMIT_40:
77  case SPEED_LIMIT_50:
78  case SPEED_LIMIT_60:
79  case SPEED_LIMIT_70:
80  case SPEED_LIMIT_80:
81  case SPEED_LIMIT_90:
82  case SPEED_LIMIT_100:
83  case SPEED_LIMIT_120:
84  case SPEED_LIMIT_130:
85  return C_SPEED_LIMIT;
86  default:
87  return C_UNKNOWN;
88  }
89  }
90 
96  {
97  switch(type_)
98  {
99  case SPEED_LIMIT_10:
100  return 10.0/3.6;
101  case SPEED_LIMIT_20:
102  return 20.0/3.6;
103  case SPEED_LIMIT_30:
104  return 30.0/3.6;
105  case SPEED_LIMIT_40:
106  return 40.0/3.6;
107  case SPEED_LIMIT_50:
108  return 50.0/3.6;
109  case SPEED_LIMIT_60:
110  return 60.0/3.6;
111  case SPEED_LIMIT_70:
112  return 70.0/3.6;
113  case SPEED_LIMIT_80:
114  return 80.0/3.6;
115  case SPEED_LIMIT_90:
116  return 90.0/3.6;
117  case SPEED_LIMIT_100:
118  return 100.0/3.6;
119  case SPEED_LIMIT_120:
120  return 120.0/3.6;
121  case SPEED_LIMIT_130:
122  return 130.0/3.6;
123  default:
124  return 0.0;
125  }
126  }
127 
130  {
131  this->coordinate_ = other.coordinate_;
132  this->id_ = other.id_;
133  this->orientation_ = other.orientation_;
134  this->type_ = other.type_;
135  }
136 
137  void translate(double dx,double dy,double dz)
138  {
139  this->coordinate_.translate(dx,dy,dz);
140  }
141  void rotate(double angle, double x0=0, double y0=0)
142  {
143  this->coordinate_.rotate(angle, x0, y0);
144  }
145 
146  int getID() const { return id_; }
147 
148  void setID(int id) { id_ = id; }
149 
150  void setType(TCDType type)
151  {
152  type_ = type;
153  }
154 
155  TCDType getType() const
156  {
157  return type_;
158  }
159 
160  void setOrientation(double orientation)
161  {
162  orientation_ = orientation;
163  }
164 
165  double getOrientation() const
166  {
167  return orientation_;
168  }
169 
171  {
172  coordinate_ = coordinate;
173  }
174 
176  {
177  return coordinate_;
178  }
179 
180 
181  private:
182 
184 
185  int id_;
186 
187  double orientation_;
188 
190  };
191  }
192 }
Definition: trafficcontroldevice.h:24
TCDClass getTCDClass()
generalization of tcd types
Definition: trafficcontroldevice.h:63
void translate(double dx, double dy, double dz)
Definition: trafficcontroldevice.h:137
double orientation_
Definition: trafficcontroldevice.h:187
void setType(TCDType type)
Definition: trafficcontroldevice.h:150
BorderBased::Coordinate coordinate_
Definition: trafficcontroldevice.h:189
BorderBased::Coordinate getCoordinate() const
Definition: trafficcontroldevice.h:175
double getNumericValue1()
Some tcd's have one or more numeric value affixed to them, e.g. speed limits have one.
Definition: trafficcontroldevice.h:95
int id_
Definition: trafficcontroldevice.h:185
void setCoordinate(BorderBased::Coordinate coordinate)
Definition: trafficcontroldevice.h:170
void setID(int id)
Definition: trafficcontroldevice.h:148
int getID() const
Definition: trafficcontroldevice.h:146
void setOrientation(double orientation)
Definition: trafficcontroldevice.h:160
TCDType getType() const
Definition: trafficcontroldevice.h:155
TrafficControlDevice(const TrafficControlDevice &other)
Definition: trafficcontroldevice.h:129
TrafficControlDevice()
Definition: trafficcontroldevice.h:128
TCDClass
Definition: trafficcontroldevice.h:52
@ C_SPEED_LIMIT
Definition: trafficcontroldevice.h:55
@ C_TRAFFIC_LIGHT
Definition: trafficcontroldevice.h:53
@ C_UNKNOWN
Definition: trafficcontroldevice.h:56
@ C_PRECEDENCE
Definition: trafficcontroldevice.h:54
TCDType type_
Definition: trafficcontroldevice.h:183
TCDType
Definition: trafficcontroldevice.h:28
@ CITY_LIMIT_SIGN
Definition: trafficcontroldevice.h:46
@ SPEED_LIMIT_40
Definition: trafficcontroldevice.h:36
@ STOP_SIGN
Definition: trafficcontroldevice.h:32
@ UNKNOWN
Definition: trafficcontroldevice.h:48
@ RIGHT_OF_WAY
Definition: trafficcontroldevice.h:31
@ TRAFFIC_LIGHT
Definition: trafficcontroldevice.h:29
@ SPEED_LIMIT_30
Definition: trafficcontroldevice.h:35
@ SPEED_LIMIT_90
Definition: trafficcontroldevice.h:41
@ SPEED_LIMIT_80
Definition: trafficcontroldevice.h:40
@ SPEED_LIMIT_70
Definition: trafficcontroldevice.h:39
@ SPEED_LIMIT_60
Definition: trafficcontroldevice.h:38
@ SPEED_LIMIT_120
Definition: trafficcontroldevice.h:43
@ SPEED_LIMIT_50
Definition: trafficcontroldevice.h:37
@ SPEED_LIMIT_10
Definition: trafficcontroldevice.h:33
@ SPEED_LIMIT_NON
Definition: trafficcontroldevice.h:45
@ SPEED_LIMIT_130
Definition: trafficcontroldevice.h:44
@ TRAFFIC_LIGHT_PEDESTRIAN
Definition: trafficcontroldevice.h:30
@ SPEED_LIMIT_20
Definition: trafficcontroldevice.h:34
@ SPEED_LIMIT_100
Definition: trafficcontroldevice.h:42
@ MOTOR_WAY_SIGN
Definition: trafficcontroldevice.h:47
void rotate(double angle, double x0=0, double y0=0)
Definition: trafficcontroldevice.h:141
double getOrientation() const
Definition: trafficcontroldevice.h:165
x0
Definition: adore_set_goal.py:25
y0
Definition: adore_set_goal.py:26
Definition: areaofeffectconverter.h:20
This struct represents 3-dimensional coordines.
Definition: coordinate.h:34
void rotate(double angle, double x0=0.0, double y0=0.0)
rotate around x0,y0
Definition: coordinate.h:100
void translate(double dx, double dy, double dz)
Translate a coordinate object.
Definition: coordinate.h:87