CARLA
 
载入中...
搜索中...
未找到
RoadInfoMarkRecord.h
浏览该文件的文档.
1// Copyright (c) 2017 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#pragma once
8
9#include "carla/road/element/RoadInfo.h" // 包含RoadInfo头文件
10#include "carla/road/element/RoadInfoMarkTypeLine.h" // 包含RoadInfoMarkTypeLine头文件
11#include <string> // 包含字符串类
12#include <vector> // 包含向量类
13#include <memory> // 包含智能指针
14
15namespace carla {
16namespace road {
17namespace element {
18
19 /// 每条车道在道路横截面内可以提供多个道路标记条目。
20 /// 道路标记信息定义了车道外边界的线条样式。
21 /// 对于左侧车道,这是左边界;对于右侧车道,这是右边界。
22 /// 左右车道之间的分隔线样式由零号车道(即中央车道)的道路标记条目决定。
23 class RoadInfoMarkRecord final : public RoadInfo {
24 public:
25
26 /// 可用作标志
27 enum class LaneChange : uint8_t {
28 None = 0x00, // 无
29 Increase = 0x01, // 增加
30 Decrease = 0x02, // 减少
31 Both = 0x03 // 两者
32 };
33
34 /// 构造函数,初始化基本属性
36 double s, // 路段位置
37 int road_mark_id) // 道路标记ID
38 : RoadInfo(s), // 调用基类构造函数
39 _road_mark_id(road_mark_id), // 初始化道路标记ID
40 _type(""), // 初始化类型为空
41 _weight(""), // 初始化重量为空
42 _color("white"), // 初始化颜色为白色
43 _material("standard"), // 初始化材料为标准
44 _width(0.15), // 初始化宽度为0.15米
45 _lane_change(LaneChange::None), // 初始化车道变更为无
46 _height(0.0), // 初始化高度为0.0米
47 _type_name(""), // 初始化类型名称为空
48 _type_width(0.0) {} // 初始化类型宽度为0.0
49
50 /// 构造函数,初始化所有属性
52 double s, // 路段位置
53 int road_mark_id, // 道路标记ID
54 std::string type, // 类型
55 std::string weight, // 重量
56 std::string color, // 颜色
57 std::string material, // 材料
58 double width, // 宽度
59 LaneChange lane_change, // 车道变更
60 double height, // 高度
61 std::string type_name, // 类型名称
62 double type_width) // 类型宽度
63 : RoadInfo(s), // 调用基类构造函数
64 _road_mark_id(road_mark_id), // 初始化道路标记ID
65 _type(type), // 初始化类型
66 _weight(weight), // 初始化重量
67 _color(color), // 初始化颜色
68 _material(material), // 初始化材料
69 _width(width), // 初始化宽度
70 _lane_change(lane_change), // 初始化车道变更
71 _height(height), // 初始化高度
72 _type_name(type_name), // 初始化类型名称
73 _type_width(type_width) {} // 初始化类型宽度
74
75 /// 接受访问者
77 v.Visit(*this); // 调用访问者的Visit方法
78 }
79
80 /// 获取道路标记的唯一标识符。
81 int GetRoadMarkId() const {
82 return _road_mark_id; // 返回道路标记ID
83 }
84
85 /// 获取道路标记的类型。
86 const std::string &GetType() const {
87 return _type; // 返回类型
88 }
89
90 /// 获取道路标记的重量。
91 const std::string &GetWeight() const {
92 return _weight; // 返回重量
93 }
94
95 /// 获取道路标记的颜色。
96 const std::string &GetColor() const {
97 return _color; // 返回颜色
98 }
99
100 /// 获取道路标记的材料(标识符待定义,目前使用“标准”)。
101 const std::string &GetMaterial() const {
102 return _material; // 返回材料
103 }
104
105 /// 获取道路标记的宽度 – 可选。
106 double GetWidth() const {
107 return _width; // 返回宽度
108 }
109
110 /// 允许在指定方向上进行车道变更,考虑到车道按升序编号从右到左。
111 /// 如果缺少此属性,假定“双方”均有效。
113 return _lane_change; // 返回车道变更状态
114 }
115
116 /// 获取道路标记顶部边缘与车道参考平面之间的物理距离。
117 double GetHeight() const {
118 return _height; // 返回高度
119 }
120
121 /// 获取道路标记类型的名称(如果有的话)。
122 const std::string &GetTypeName() const {
123 return _type_name; // 返回类型名称
124 }
125
126 /// 获取道路标记类型的宽度(如果有的话)。
127 double GetTypeWidth() const {
128 return _type_width; // 返回类型宽度
129 }
130
131 /// 获取道路标记线条的集合
132 std::vector<std::unique_ptr<RoadInfoMarkTypeLine>> &GetLines() {
133 return _lines; // 返回线条集合
134 }
135
136 private:
137
138 const int _road_mark_id; // 道路标记ID
139
140 const std::string _type; // 标记类型
141
142 const std::string _weight; // 标记重量
143
144 const std::string _color; // 标记颜色
145
146 const std::string _material; // 标记材料
147
148 const double _width; // 标记宽度
149
150 const LaneChange _lane_change; // 车道变更状态
151
152 const double _height; // 标记高度
153
154 const std::string _type_name; // 标记类型名称
155
156 const double _type_width; // 标记类型宽度
157
158 std::vector<std::unique_ptr<RoadInfoMarkTypeLine>> _lines; // 道路标记线条集合
159 };
160} // namespace element
161} // namespace road
162} // namespace carla
每条车道在道路横截面内可以提供多个道路标记条目。 道路标记信息定义了车道外边界的线条样式。 对于左侧车道,这是左边界;对于右侧车道,这是右边界。 左右车道之间的分隔线样式由零号车道(即中央车道)的道路标...
const std::string & GetWeight() const
获取道路标记的重量。
const std::string & GetTypeName() const
获取道路标记类型的名称(如果有的话)。
RoadInfoMarkRecord(double s, int road_mark_id, std::string type, std::string weight, std::string color, std::string material, double width, LaneChange lane_change, double height, std::string type_name, double type_width)
构造函数,初始化所有属性
int GetRoadMarkId() const
获取道路标记的唯一标识符。
std::vector< std::unique_ptr< RoadInfoMarkTypeLine > > & GetLines()
获取道路标记线条的集合
const std::string & GetType() const
获取道路标记的类型。
double GetTypeWidth() const
获取道路标记类型的宽度(如果有的话)。
std::vector< std::unique_ptr< RoadInfoMarkTypeLine > > _lines
void AcceptVisitor(RoadInfoVisitor &v) final
接受访问者
const std::string & GetColor() const
获取道路标记的颜色。
double GetHeight() const
获取道路标记顶部边缘与车道参考平面之间的物理距离。
LaneChange GetLaneChange() const
允许在指定方向上进行车道变更,考虑到车道按升序编号从右到左。 如果缺少此属性,假定“双方”均有效。
const std::string & GetMaterial() const
获取道路标记的材料(标识符待定义,目前使用“标准”)。
double GetWidth() const
获取道路标记的宽度 – 可选。
RoadInfoMarkRecord(double s, int road_mark_id)
构造函数,初始化基本属性
CARLA模拟器的主命名空间。
Definition Carla.cpp:139