CARLA
 
载入中...
搜索中...
未找到
LaneSection.h
浏览该文件的文档.
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#pragma once
8
9#include "carla/geom/CubicPolynomial.h" // 包含立方多项式几何操作的头文件
10#include "carla/NonCopyable.h" // 包含非拷贝类功能的头文件
11#include "carla/road/Lane.h" // 包含车道类定义的头文件
12#include "carla/road/RoadElementSet.h" // 包含道路元素集合的头文件
13#include "carla/road/RoadTypes.h" // 包含各种道路类型定义的头文件
14
15#include <map> // 包含 std::map 容器的头文件
16#include <vector> // 包含 std::vector 容器的头文件
17
18namespace carla {
19namespace road {
20
21 class Road; // 前向声明 Road 类
22 class MapBuilder; // 前向声明 MapBuilder 类
23
24 class LaneSection : private MovableNonCopyable { // LaneSection 类继承非拷贝行为
25 public:
26
27 explicit LaneSection(SectionId id, double s) : _id(id), _s(s) {} // 构造函数初始化 ID 和位置
28
29 double GetDistance() const; // 方法获取与节段开始的距离
30
31 double GetLength() const; // 方法获取车道节段的长度
32
33 Road *GetRoad() const; // 方法获取关联的 Road 对象
34
35 Lane *GetLane(const LaneId id); // 方法通过 ID 获取 Lane 对象
36
37 const Lane *GetLane(const LaneId id) const; // 常量方法通过 ID 获取 Lane 对象
38
39 bool ContainsLane(LaneId id) const { // 方法检查节段中是否包含指定车道
40 return (_lanes.find(id) != _lanes.end()); // 如果找到车道 ID,返回 true
41 }
42
43 SectionId GetId() const; // 方法获取节段 ID
44
45 std::map<LaneId, Lane> &GetLanes(); // 方法获取可修改的车道引用
46
47 const std::map<LaneId, Lane> &GetLanes() const; // 常量方法获取车道引用,不能修改
48
49 std::vector<Lane *> GetLanesOfType(Lane::LaneType type); // 方法获取特定类型的车道
50
51 private:
52
53 friend MapBuilder; // 允许 MapBuilder 访问私有成员
54
55 const SectionId _id = 0u; // 车道节段的唯一标识符
56
57 const double _s = 0.0; // 该节段在道路上的起始位置
58
59 Road *_road = nullptr; // 指向关联 Road 对象的指针
60
61 std::map<LaneId, Lane> _lanes; // 该节段中的车道集合,以 ID 索引
62
63 geom::CubicPolynomial _lane_offset; // 用于车道偏移计算的立方多项式
64 };
65
66} // namespace road
67} // namespace carla
这个类用于禁止拷贝构造函数和赋值操作,但允许移动构造函数和赋值操作
定义一个三次多项式CubicPolynomial类,用于描述和计算三次多项式 f(x) = a + b * x + c * x^2 + d * x^3
SectionId GetId() const
double GetDistance() const
Lane * GetLane(const LaneId id)
LaneSection(SectionId id, double s)
Definition LaneSection.h:27
bool ContainsLane(LaneId id) const
Definition LaneSection.h:39
std::map< LaneId, Lane > _lanes
Definition LaneSection.h:61
std::vector< Lane * > GetLanesOfType(Lane::LaneType type)
const SectionId _id
Definition LaneSection.h:55
geom::CubicPolynomial _lane_offset
Definition LaneSection.h:63
std::map< LaneId, Lane > & GetLanes()
LaneType
可以作为标志使用
Definition Lane.h:29
uint32_t SectionId
Definition RoadTypes.h:29
int32_t LaneId
Definition RoadTypes.h:26
CARLA模拟器的主命名空间。
Definition Carla.cpp:139