CARLA
Loading...
Searching...
No Matches
DebugHelper.cpp
Go to the documentation of this file.
1// Copyright (c) 2026 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
8
11
12namespace carla {
13namespace client {
14
16
17 template <typename T>
18 static void DrawShape(
19 detail::EpisodeProxy &episode,
20 const T &primitive,
21 rpc::Color color,
22 float life_time,
23 bool persistent_lines) {
24 const Shape shape{primitive, color, life_time, persistent_lines};
25 episode.Lock()->DrawDebugShape(shape);
26 }
27
29 const geom::Location &location,
30 float size,
32 float life_time,
33 bool persistent_lines) {
34 Shape::Point point{location, size};
35 DrawShape(_episode, point, color, life_time, persistent_lines);
36 }
37
39 const geom::Location &begin,
40 const geom::Location &end,
41 float thickness,
43 float life_time,
44 bool persistent_lines) {
45 Shape::Line line{begin, end, thickness};
46 DrawShape(_episode, line, color, life_time, persistent_lines);
47 }
48
50 const geom::Location &begin,
51 const geom::Location &end,
52 float thickness,
53 float arrow_size,
55 float life_time,
56 bool persistent_lines) {
57 Shape::Line line{begin, end, thickness};
58 Shape::Arrow arrow{line, arrow_size};
59 DrawShape(_episode, arrow, color, life_time, persistent_lines);
60 }
61
63 const geom::BoundingBox &box,
64 const geom::Rotation &rotation,
65 float thickness,
67 float life_time,
68 bool persistent_lines) {
69 Shape::Box the_box{box, rotation, thickness};
70 DrawShape(_episode, the_box, color, life_time, persistent_lines);
71 }
72
74 const geom::Location &location,
75 const std::string &text,
76 bool draw_shadow,
78 float life_time,
79 bool persistent_lines) {
80 Shape::String string{location, text, draw_shadow};
81 DrawShape(_episode, string, color, life_time, persistent_lines);
82 }
83
85 _episode.Lock()->ClearDebugShape();
86 }
87
89 _episode.Lock()->ClearDebugString();
90 }
91
92} // namespace client
93} // namespace carla
geom::Point point
Definition LaneGraph.cpp:41
void ClearDebugString()
Clear every persistent debug string currently shown in the HUD.
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)
detail::EpisodeProxy _episode
Definition DebugHelper.h:75
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 ClearDebugShape()
Clear every persistent debug shape (lines, points, boxes, arrows) previously drawn from this world.
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)
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)
SharedPtrType Lock() const
Same as TryLock but never return nullptr.
Euler angles of a rotation in CARLA's / Unreal's left-handed frame: x forward, y right,...
Definition Rotation.h:45
static void DrawShape(detail::EpisodeProxy &episode, const T &primitive, rpc::Color color, float life_time, bool persistent_lines)
This file contains definitions of common data structures used in traffic manager.