CARLA
 
载入中...
搜索中...
未找到
SignalType.cpp
浏览该文件的文档.
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" // 引入 SignalType.h 头文件
8
9#include <vector> // 引入 vector 头文件
10#include <algorithm> // 引入 algorithm 头文件
11
12namespace carla { // 定义命名空间 carla
13namespace road { // 定义命名空间 road
14
15 const std::string SignalType::Danger() { // 定义危险信号类型
16 return "101"; // 返回 "101"
17 } // 从 101 到 151 的危险类型
18 const std::string SignalType::LanesMerging() { // 定义车道合并信号类型
19 return "121"; // 返回 "121"
20 } // = "121";
21 const std::string SignalType::CautionPedestrian() { // 定义小心行人信号类型
22 return "133"; // 返回 "133"
23 } // = "133";
24 const std::string SignalType::CautionBicycle() { // 定义小心自行车信号类型
25 return "138"; // 返回 "138"
26 } // = "138";
27 const std::string SignalType::LevelCrossing() { // 定义平交道口信号类型
28 return "150"; // 返回 "150"
29 } // = "150";
30 const std::string SignalType::YieldSign() { // 定义让行标志信号类型
31 return "205"; // 返回 "205"
32 } // = "205";
33 const std::string SignalType::StopSign() { // 定义停车标志信号类型
34 return "206"; // 返回 "206"
35 } // = "206";
36 const std::string SignalType::MandatoryTurnDirection() { // 定义强制转向方向信号类型
37 return "209"; // 返回 "209" // 左转、右转或直行
38 } // = "209";
39 const std::string SignalType::MandatoryLeftRightDirection() { // 定义强制左转或右转信号类型
40 return "211"; // 返回 "211"
41 } // = "211";
42 const std::string SignalType::TwoChoiceTurnDirection() { // 定义两种选择转向信号类型
43 return "214"; // 返回 "214" // 直行-左转、直行-右转、左转-右转
44 } // = "214";
45 const std::string SignalType::Roundabout() { // 定义环形交叉口信号类型
46 return "215"; // 返回 "215"
47 } // = "215";
48 const std::string SignalType::PassRightLeft() { // 定义右侧左侧通行信号类型
49 return "222"; // 返回 "222"
50 } // = "222";
51 const std::string SignalType::AccessForbidden() { // 定义禁止通行信号类型
52 return "250"; // 返回 "250"
53 } // = "250";
54 const std::string SignalType::AccessForbiddenMotorvehicles() { // 定义禁止机动车通行信号类型
55 return "251"; // 返回 "251"
56 } // = "251";
57 const std::string SignalType::AccessForbiddenTrucks() { // 定义禁止卡车通行信号类型
58 return "253"; // 返回 "253"
59 } // = "253";
60 const std::string SignalType::AccessForbiddenBicycle() { // 定义禁止自行车通行信号类型
61 return "254"; // 返回 "254"
62 } // = "254";
63 const std::string SignalType::AccessForbiddenWeight() { // 定义禁止超重通行信号类型
64 return "263"; // 返回 "263"
65 } // = "263";
66 const std::string SignalType::AccessForbiddenWidth() { // 定义禁止超宽通行信号类型
67 return "264"; // 返回 "264"
68 } // = "264";
69 const std::string SignalType::AccessForbiddenHeight() { // 定义禁止超高通行信号类型
70 return "265"; // 返回 "265"
71 } // = "265";
72 const std::string SignalType::AccessForbiddenWrongDirection() { // 定义禁止错误方向通行信号类型
73 return "267"; // 返回 "267"
74 } // = "267";
75 const std::string SignalType::ForbiddenUTurn() { // 定义禁止掉头信号类型
76 return "272"; // 返回 "272"
77 } // = "272";
78 const std::string SignalType::MaximumSpeed() { // 定义最高速度信号类型
79 return "274"; // 返回 "274"
80 } // = "274";
81 const std::string SignalType::ForbiddenOvertakingMotorvehicles() { // 定义禁止超车信号类型(机动车)
82 return "276"; // 返回 "276"
83 } // = "276";
84 const std::string SignalType::ForbiddenOvertakingTrucks() { // 定义禁止超车信号类型(卡车)
85 return "277"; // 返回 "277"
86 } // = "277";
87 const std::string SignalType::AbsoluteNoStop() { // 定义绝对禁止停车信号类型
88 return "283"; // 返回 "283"
89 } // = "283";
90 const std::string SignalType::RestrictedStop() { // 定义限制停车信号类型
91 return "286"; // 返回 "286"
92 } // = "286";
93 const std::string SignalType::HasWayNextIntersection() { // 定义下个交叉口优先通行信号类型
94 return "301"; // 返回 "301"
95 } // = "301";
96 const std::string SignalType::PriorityWay() { // 定义优先通行信号类型
97 return "306"; // 返回 "306"
98 } // = "306";
99 const std::string SignalType::PriorityWayEnd() { // 定义优先通行结束信号类型
100 return "307"; // 返回 "307"
101 } // = "307";
102 const std::string SignalType::CityBegin() { // 定义城市开始信号类型
103 return "310"; // 返回 "310"
104 } // = "310";
105 const std::string SignalType::CityEnd() { // 定义城市结束信号类型
106 return "311"; // 返回 "311"
107 } // = "311";
108 const std::string SignalType::Highway() { // 定义高速公路信号类型
109 return "330"; // 返回 "330"
110 } // = "330";
111 const std::string SignalType::DeadEnd() { // 定义死胡同信号类型
112 return "357"; // 返回 "357"
113 } // = "357";
114 const std::string SignalType::RecomendedSpeed() { // 定义推荐速度信号类型
115 return "380"; // 返回 "380"
116 } // = "380";
117 const std::string SignalType::RecomendedSpeedEnd() { // 定义推荐速度结束信号类型
118 return "381"; // 返回 "381"
119 } // = "381";
120
121 bool SignalType::IsTrafficLight(const std::string &type) { // 定义函数判断是否为交通信号灯
122 // 交通信号灯对应的类型
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; // 返回 true
133 } else {
134 return false; // 否则返回 false
135 }
136 }
137
138}
139}
static const std::string CautionBicycle()
static const std::string AccessForbiddenWrongDirection()
static const std::string AccessForbiddenBicycle()
static const std::string RecomendedSpeed()
static const std::string AbsoluteNoStop()
static const std::string MandatoryTurnDirection()
static const std::string DeadEnd()
static const std::string AccessForbidden()
static const std::string RestrictedStop()
static const std::string LevelCrossing()
static const std::string CityBegin()
static const std::string ForbiddenUTurn()
static const std::string ForbiddenOvertakingTrucks()
static const std::string YieldSign()
static const std::string Danger()
static const std::string RecomendedSpeedEnd()
static const std::string AccessForbiddenMotorvehicles()
static const std::string CautionPedestrian()
static const std::string Highway()
static const std::string AccessForbiddenHeight()
static const std::string Roundabout()
static const std::string PassRightLeft()
static const std::string HasWayNextIntersection()
static bool IsTrafficLight(const std::string &type)
static const std::string CityEnd()
static const std::string ForbiddenOvertakingMotorvehicles()
static const std::string LanesMerging()
static const std::string AccessForbiddenWeight()
static const std::string MandatoryLeftRightDirection()
static const std::string MaximumSpeed()
static const std::string PriorityWayEnd()
static const std::string AccessForbiddenTrucks()
static const std::string PriorityWay()
static const std::string TwoChoiceTurnDirection()
static const std::string StopSign()
static const std::string AccessForbiddenWidth()
CARLA模拟器的主命名空间。
Definition Carla.cpp:139