CARLA
 
载入中...
搜索中...
未找到
DebugHelper.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/client/detail/EpisodeProxy.h" // 包含 EpisodeProxy 的头文件
10#include "carla/geom/BoundingBox.h" // 包含 BoundingBox 的头文件
11#include "carla/geom/Location.h" // 包含 Location 的头文件
12#include "carla/geom/Rotation.h" // 包含 Rotation 的头文件
13#include "carla/sensor/data/Color.h" // 包含 Color 数据类型的头文件
14
15namespace carla {
16namespace client {
17
19 public:
20
21 using Color = sensor::data::Color; // 定义 Color 类型为 sensor::data::Color
22
23 // 构造函数,接受一个 EpisodeProxy 对象
25 : _episode(std::move(episode)) {} // 初始化成员变量 _episode
26
27 // 绘制点
28 void DrawPoint(
29 const geom::Location &location, // 点的位置
30 float size = 0.1f, // 点的大小,默认值为 0.1
31 Color color = Color{255u, 0u, 0u}, // 点的颜色,默认值为红色
32 float life_time = -1.0f, // 点的生命周期,默认值为无限
33 bool persistent_lines = true); // 是否绘制持久线
34
35 // 在 HUD 上绘制点
36 void DrawHUDPoint(
37 const geom::Location &location, // 点的位置
38 float size = 0.1f, // 点的大小,默认值为 0.1
39 Color color = Color{255u, 0u, 0u}, // 点的颜色,默认值为红色
40 float life_time = -1.0f, // 点的生命周期,默认值为无限
41 bool persistent_lines = true); // 是否绘制持久线
42
43 // 绘制线段
44 void DrawLine(
45 const geom::Location &begin, // 线段起点的位置
46 const geom::Location &end, // 线段终点的位置
47 float thickness = 0.1f, // 线段的粗细,默认值为 0.1
48 Color color = Color{255u, 0u, 0u}, // 线段的颜色,默认值为红色
49 float life_time = -1.0f, // 线段的生命周期,默认值为无限
50 bool persistent_lines = true); // 是否绘制持久线
51
52 // 在 HUD 上绘制线段
53 void DrawHUDLine(
54 const geom::Location &begin, // 线段起点的位置
55 const geom::Location &end, // 线段终点的位置
56 float thickness = 1.0f, // 线段的粗细,默认值为 1.0
57 Color color = Color{225u, 0u, 0u}, // 线段的颜色,默认值为深红色
58 float life_time = -1.0f, // 线段的生命周期,默认值为无限
59 bool persistent_lines = true); // 是否绘制持久线
60
61 // 绘制箭头
62 void DrawArrow(
63 const geom::Location &begin, // 箭头的起点位置
64 const geom::Location &end, // 箭头的终点位置
65 float thickness = 0.1f, // 箭头的粗细,默认值为 0.1
66 float arrow_size = 0.1f, // 箭头的大小,默认值为 0.1
67 Color color = Color{255u, 0u, 0u}, // 箭头的颜色,默认值为红色
68 float life_time = -1.0f, // 箭头的生命周期,默认值为无限
69 bool persistent_lines = true); // 是否绘制持久线
70
71 // 在 HUD 上绘制箭头
72 void DrawHUDArrow(
73 const geom::Location &begin, // 箭头的起点位置
74 const geom::Location &end, // 箭头的终点位置
75 float thickness = 0.1f, // 箭头的粗细,默认值为 0.1
76 float arrow_size = 0.1f, // 箭头的大小,默认值为 0.1
77 Color color = Color{255u, 0u, 0u}, // 箭头的颜色,默认值为红色
78 float life_time = -1.0f, // 箭头的生命周期,默认值为无限
79 bool persistent_lines = true); // 是否绘制持久线
80
81 // 绘制矩形框
82 void DrawBox(
83 const geom::BoundingBox &box, // 矩形框的边界
84 const geom::Rotation &rotation, // 矩形框的旋转
85 float thickness = 0.1f, // 矩形框的粗细,默认值为 0.1
86 Color color = Color{255u, 0u, 0u}, // 矩形框的颜色,默认值为红色
87 float life_time = -1.0f, // 矩形框的生命周期,默认值为无限
88 bool persistent_lines = true); // 是否绘制持久线
89
90 // 在 HUD 上绘制矩形框
91 void DrawHUDBox(
92 const geom::BoundingBox &box, // 矩形框的边界
93 const geom::Rotation &rotation, // 矩形框的旋转
94 float thickness = 0.1f, // 矩形框的粗细,默认值为 0.1
95 Color color = Color{255u, 0u, 0u}, // 矩形框的颜色,默认值为红色
96 float life_time = -1.0f, // 矩形框的生命周期,默认值为无限
97 bool persistent_lines = true); // 是否绘制持久线
98
99 // 绘制字符串
100 void DrawString(
101 const geom::Location &location, // 字符串的位置
102 const std::string &text, // 要绘制的字符串
103 bool draw_shadow = false, // 是否绘制阴影
104 Color color = Color{255u, 0u, 0u}, // 字符串的颜色,默认值为红色
105 float life_time = -1.0f, // 字符串的生命周期,默认值为无限
106 bool persistent_lines = true); // 是否绘制持久线
107
108 private:
109
110 detail::EpisodeProxy _episode; // 存储 EpisodeProxy 对象
111 };
112
113} // namespace client
114} // namespace carla
115
auto end() const noexcept
auto begin() const noexcept
名称范围迭代支持
void DrawHUDArrow(const geom::Location &begin, const geom::Location &end, float thickness=0.1f, float arrow_size=0.1f, Color color=Color{255u, 0u, 0u}, float life_time=-1.0f, bool persistent_lines=true)
void DrawString(const geom::Location &location, const std::string &text, bool draw_shadow=false, Color color=Color{255u, 0u, 0u}, float life_time=-1.0f, bool persistent_lines=true)
void DrawLine(const geom::Location &begin, const geom::Location &end, float thickness=0.1f, Color color=Color{255u, 0u, 0u}, float life_time=-1.0f, bool persistent_lines=true)
void DrawHUDLine(const geom::Location &begin, const geom::Location &end, float thickness=1.0f, Color color=Color{225u, 0u, 0u}, float life_time=-1.0f, bool persistent_lines=true)
detail::EpisodeProxy _episode
void DrawHUDPoint(const geom::Location &location, float size=0.1f, Color color=Color{255u, 0u, 0u}, float life_time=-1.0f, bool persistent_lines=true)
void DrawHUDBox(const geom::BoundingBox &box, const geom::Rotation &rotation, float thickness=0.1f, Color color=Color{255u, 0u, 0u}, float life_time=-1.0f, bool persistent_lines=true)
void DrawArrow(const geom::Location &begin, const geom::Location &end, float thickness=0.1f, float arrow_size=0.1f, Color color=Color{255u, 0u, 0u}, float life_time=-1.0f, bool persistent_lines=true)
void DrawPoint(const geom::Location &location, float size=0.1f, Color color=Color{255u, 0u, 0u}, float life_time=-1.0f, bool persistent_lines=true)
DebugHelper(detail::EpisodeProxy episode)
Definition DebugHelper.h:24
void DrawBox(const geom::BoundingBox &box, const geom::Rotation &rotation, float thickness=0.1f, Color color=Color{255u, 0u, 0u}, float life_time=-1.0f, bool persistent_lines=true)
CARLA模拟器的主命名空间。
Definition Carla.cpp:139
包含CARLA客户端相关类和函数的命名空间。