CARLA
SignalType.cpp
Go to the documentation of this file.
1 // Copyright (c) 2020 Computer Vision Center (CVC) at the Universitat Autonoma
2 // de Barcelona (UAB).
3 //
4 // This work is licensed under the terms of the MIT license.
5 // For a copy; see <https://opensource.org/licenses/MIT>.
6 
7 #include "SignalType.h"
8 
9 #include <vector>
10 #include <algorithm>
11 
12 namespace carla {
13 namespace road {
14 
15  const std::string SignalType::Danger() {
16  return "101";
17  } // danger types from 101 to 151
18  const std::string SignalType::LanesMerging() {
19  return "121";
20  } // = "121";
21  const std::string SignalType::CautionPedestrian() {
22  return "133";
23  } // = "133";
24  const std::string SignalType::CautionBicycle() {
25  return "138";
26  } // = "138";
27  const std::string SignalType::LevelCrossing() {
28  return "150";
29  } // = "150";
30  const std::string SignalType::YieldSign() {
31  return "205";
32  } // = "205";
33  const std::string SignalType::StopSign() {
34  return "206";
35  } // = "206";
36  const std::string SignalType::MandatoryTurnDirection() {
37  return "209";
38  } // = "209"; // Left, right or forward
40  return "211";
41  } // = "211";
42  const std::string SignalType::TwoChoiceTurnDirection() {
43  return "214";
44  } // = "214"; // Forward-left, forward-right, left-right
45  const std::string SignalType::Roundabout() {
46  return "215";
47  } // = "215";
48  const std::string SignalType::PassRightLeft() {
49  return "222";
50  } // = "222";
51  const std::string SignalType::AccessForbidden() {
52  return "250";
53  } // = "250";
55  return "251";
56  } // = "251";
57  const std::string SignalType::AccessForbiddenTrucks() {
58  return "253";
59  } // = "253";
60  const std::string SignalType::AccessForbiddenBicycle() {
61  return "254";
62  } // = "254";
63  const std::string SignalType::AccessForbiddenWeight() {
64  return "263";
65  } // = "263";
66  const std::string SignalType::AccessForbiddenWidth() {
67  return "264";
68  } // = "264";
69  const std::string SignalType::AccessForbiddenHeight() {
70  return "265";
71  } // = "265";
73  return "267";
74  } // = "267";
75  const std::string SignalType::ForbiddenUTurn() {
76  return "272";
77  } // = "272";
78  const std::string SignalType::MaximumSpeed() {
79  return "274";
80  } // = "274";
82  return "276";
83  } // = "276";
85  return "277";
86  } // = "277";
87  const std::string SignalType::AbsoluteNoStop() {
88  return "283";
89  } // = "283";
90  const std::string SignalType::RestrictedStop() {
91  return "286";
92  } // = "286";
93  const std::string SignalType::HasWayNextIntersection() {
94  return "301";
95  } // = "301";
96  const std::string SignalType::PriorityWay() {
97  return "306";
98  } // = "306";
99  const std::string SignalType::PriorityWayEnd() {
100  return "307";
101  } // = "307";
102  const std::string SignalType::CityBegin() {
103  return "310";
104  } // = "310";
105  const std::string SignalType::CityEnd() {
106  return "311";
107  } // = "311";
108  const std::string SignalType::Highway() {
109  return "330";
110  } // = "330";
111  const std::string SignalType::DeadEnd() {
112  return "357";
113  } // = "357";
114  const std::string SignalType::RecomendedSpeed() {
115  return "380";
116  } // = "380";
117  const std::string SignalType::RecomendedSpeedEnd() {
118  return "381";
119  } // = "381";
120 
121  bool SignalType::IsTrafficLight(const std::string &type) {
122  // Types corresponding to traffic lights
123  const std::vector<std::string> traffic_light_types =
124  {"1000001", "1000002", "1000009", "1000010", "1000011",
125  "1000007", "1000014", "1000015", "1000016", "1000017",
126  "1000018", "1000019", "1000013", "1000020", "1000008",
127  "1000012", "F", "W", "A"};
128 
129  auto it = std::find(
130  traffic_light_types.begin(), traffic_light_types.end(), type);
131  if (it != traffic_light_types.end()){
132  return true;
133  } else {
134  return false;
135  }
136  }
137 
138 }
139 }
static const std::string AccessForbiddenWidth()
Definition: SignalType.cpp:66
static const std::string DeadEnd()
Definition: SignalType.cpp:111
static const std::string TwoChoiceTurnDirection()
Definition: SignalType.cpp:42
static const std::string RestrictedStop()
Definition: SignalType.cpp:90
static const std::string PriorityWay()
Definition: SignalType.cpp:96
static const std::string Danger()
Definition: SignalType.cpp:15
static const std::string CautionPedestrian()
Definition: SignalType.cpp:21
This file contains definitions of common data structures used in traffic manager. ...
Definition: Carla.cpp:133
static const std::string RecomendedSpeedEnd()
Definition: SignalType.cpp:117
static const std::string CityBegin()
Definition: SignalType.cpp:102
static const std::string CautionBicycle()
Definition: SignalType.cpp:24
static const std::string AccessForbidden()
Definition: SignalType.cpp:51
static const std::string AccessForbiddenBicycle()
Definition: SignalType.cpp:60
static const std::string AbsoluteNoStop()
Definition: SignalType.cpp:87
static const std::string LevelCrossing()
Definition: SignalType.cpp:27
static const std::string LanesMerging()
Definition: SignalType.cpp:18
static const std::string MaximumSpeed()
Definition: SignalType.cpp:78
static const std::string YieldSign()
Definition: SignalType.cpp:30
static const std::string StopSign()
Definition: SignalType.cpp:33
static const std::string Highway()
Definition: SignalType.cpp:108
static const std::string AccessForbiddenWrongDirection()
Definition: SignalType.cpp:72
static const std::string AccessForbiddenHeight()
Definition: SignalType.cpp:69
static const std::string PassRightLeft()
Definition: SignalType.cpp:48
static const std::string HasWayNextIntersection()
Definition: SignalType.cpp:93
static const std::string MandatoryLeftRightDirection()
Definition: SignalType.cpp:39
static const std::string AccessForbiddenMotorvehicles()
Definition: SignalType.cpp:54
static const std::string ForbiddenUTurn()
Definition: SignalType.cpp:75
static const std::string AccessForbiddenTrucks()
Definition: SignalType.cpp:57
static bool IsTrafficLight(const std::string &type)
Definition: SignalType.cpp:121
static const std::string RecomendedSpeed()
Definition: SignalType.cpp:114
static const std::string PriorityWayEnd()
Definition: SignalType.cpp:99
static const std::string AccessForbiddenWeight()
Definition: SignalType.cpp:63
static const std::string CityEnd()
Definition: SignalType.cpp:105
static const std::string ForbiddenOvertakingMotorvehicles()
Definition: SignalType.cpp:81
static const std::string MandatoryTurnDirection()
Definition: SignalType.cpp:36
static const std::string ForbiddenOvertakingTrucks()
Definition: SignalType.cpp:84
static const std::string Roundabout()
Definition: SignalType.cpp:45