CARLA
载入中...
搜索中...
未找到
LibCarla
source
carla
road
element
road/element/Waypoint.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/RoadTypes.h
"
// 包含道路类型定义
10
11
#include <cstdint>
// 包含标准整数类型定义
12
#include <functional>
// 包含函数对象和函数适配器定义
13
14
namespace
carla
{
15
namespace
road {
16
namespace
element {
17
18
struct
Waypoint
{
// 定义Waypoint结构体
19
20
RoadId
road_id
= 0u;
// 道路ID
21
22
SectionId
section_id
= 0u;
// 路段ID
23
24
LaneId
lane_id
= 0;
// 车道ID
25
26
double
s
= 0.0;
// 沿道路的偏移量
27
};
28
29
}
// namespace element
30
}
// namespace road
31
}
// namespace carla
32
33
namespace
std
{
34
35
template
<>
36
struct
hash<
carla
::road::element::Waypoint> {
// 定义Waypoint的哈希函数
37
38
using
argument_type
=
carla::road::element::Waypoint
;
// 参数类型
39
40
using
result_type
= uint64_t;
// 结果类型
41
42
/// 根据@a waypoint的road_id、lane_id、section_id和"s"偏移量生成一个唯一的ID
43
/// "s"偏移量被截断到半厘米精度
44
///
45
result_type
operator()(
const
argument_type
&waypoint)
const
;
// 哈希函数实现
46
47
};
48
49
}
// namespace std
50
51
namespace
carla
{
52
namespace
road {
53
namespace
element {
54
55
inline
bool
operator==
(
const
Waypoint
&lhs,
const
Waypoint
&rhs) {
// 定义等于运算符
56
auto
hasher = std::hash<Waypoint>();
// 创建哈希对象
57
return
hasher(lhs) == hasher(rhs);
// 返回哈希值是否相等
58
}
59
60
inline
bool
operator!=
(
const
Waypoint
&lhs,
const
Waypoint
&rhs) {
// 定义不等于运算符
61
return
!
operator==
(lhs, rhs);
// 返回不等于运算符的结果
62
}
63
64
}
// namespace element
65
}
// namespace road
66
}
// namespace carla
RoadTypes.h
carla::road::element::operator==
bool operator==(const Waypoint &lhs, const Waypoint &rhs)
Definition
road/element/Waypoint.h:55
carla::road::element::operator!=
bool operator!=(const Waypoint &lhs, const Waypoint &rhs)
Definition
road/element/Waypoint.h:60
carla::road::SectionId
uint32_t SectionId
Definition
RoadTypes.h:29
carla::road::LaneId
int32_t LaneId
Definition
RoadTypes.h:26
carla::road::RoadId
uint32_t RoadId
Definition
RoadTypes.h:20
carla
CARLA模拟器的主命名空间。
Definition
Carla.cpp:139
std
Definition
CarlaRecorderCollision.h:31
carla::road::element::Waypoint
Definition
road/element/Waypoint.h:18
carla::road::element::Waypoint::section_id
SectionId section_id
Definition
road/element/Waypoint.h:22
carla::road::element::Waypoint::road_id
RoadId road_id
Definition
road/element/Waypoint.h:20
carla::road::element::Waypoint::lane_id
LaneId lane_id
Definition
road/element/Waypoint.h:24
carla::road::element::Waypoint::s
double s
Definition
road/element/Waypoint.h:26
std::hash< carla::road::element::Waypoint >::result_type
uint64_t result_type
Definition
road/element/Waypoint.h:40
制作者
1.10.0