Added stubs for HUD drawing

Functions from #7168
This commit is contained in:
Daniel 2024-07-24 14:48:37 +02:00 committed by Daraan
parent abf1ee7492
commit 556c93c1f5
1 changed files with 68 additions and 9 deletions

View File

@ -1211,11 +1211,16 @@ class DVSEventArray():
class DebugHelper():
"""Helper class part of `carla.World` that defines methods for creating debug shapes. By default, shapes last one second. They can be permanent, but take into account the resources needed to do so. Take a look at the snippets available for this class to learn how to debug easily in CARLA."""
"""
Helper class part of `carla.World` that defines methods for creating debug shapes. By default,
shapes last one second. They can be permanent, but take into account the resources needed to do
so. Take a look at the snippets available for this class to learn how to debug easily in CARLA.
"""
# region Methods
def draw_arrow(self, begin: Location, end: Location, thickness=0.1, arrow_size=0.1, color: Color = (255, 0, 0), life_time=-1.0):
"""Draws an arrow from `begin` to `end` pointing in that direction.
def draw_arrow(self, begin: Location, end: Location, thickness=0.1, arrow_size=0.1, color: Color = (255, 0, 0), life_time=-1.0, persistent_lines=True):
"""
Draws an arrow from `begin` to `end` pointing in that direction.
Args:
begin (Location): Point in the coordinate system where the arrow starts (meters).
@ -1227,7 +1232,20 @@ class DebugHelper():
"""
...
def draw_box(self, box: BoundingBox, rotation: Rotation, thickness=0.1, color: Color = (255, 0, 0), life_time=-1.0):
def draw_hud_arrow(self, begin: Location, end: Location, thickness=0.1, arrow_size=0.1, color: Color = (255, 0, 0), life_time=-1.0, persistent_lines=True):
"""
Draws an arrow on the HUD from `begin` to `end` which can only be seen server-side.
Args:
begin (Location): Point in the coordinate system where the arrow starts (meters).
end (Location): Point in the coordinate system where the arrow ends and points towards to (meters).
thickness (float, optional): Density of the line (meters). Defaults to 0.1.
arrow_size (float, optional): Size of the tip of the arrow (meters). Defaults to 0.1.
color (Color, optional): RGB code to color the object. Defaults to (255,0,0).
life_time (float, optional): Shape's lifespan. By default it only lasts one frame. Set this to `0` for permanent shapes (seconds). Defaults to -1.0.
"""
def draw_box(self, box: BoundingBox, rotation: Rotation, thickness=0.1, color: Color = (255, 0, 0), life_time=-1.0, persistent_lines=True):
"""Draws a box, usually to act for object colliders.
Args:
@ -1239,8 +1257,23 @@ class DebugHelper():
"""
...
def draw_line(self, begin: Location, end: Location, thickness=0.1, color: Color = (255, 0, 0), life_time=-1.0):
"""Draws a line in between `begin` and `end`.
def draw_hud_box(self, box: BoundingBox, rotation: Rotation, thickness=0.1, color: Color = (255, 0, 0), life_time=-1.0, persistent_lines=True):
"""
Draws a box on the HUD, usually to act for object colliders. The box can only be seen server-side.
Args:
box (BoundingBox): Object containing a location and the length of a box for every axis.
rotation (Rotation): Orientation of the box according to Unreal Engine's axis system (degrees (pitch,yaw,roll)).
thickness (float, optional): Density of the lines that define the box (meters). Defaults to 0.1.
color (Color, optional): RGB code to color the object. Defaults to (255,0,0).
life_time (float, optional): Shape's lifespan. By default it only lasts one frame. Set this to `0` for permanent shapes. Defaults to -1.0.
"""
...
def draw_line(self, begin: Location, end: Location, thickness=0.1, color: Color = (255, 0, 0), life_time=-1.0, persistent_lines=True):
"""
Draws a line in between `begin` and `end`.
Args:
begin (Location): Point in the coordinate system where the line starts (meters).
@ -1251,8 +1284,22 @@ class DebugHelper():
"""
...
def draw_point(self, location: Location, size=0.1, color=(255, 0, 0), life_time=-1.0):
"""Draws a point location.
def draw_hud_line(self, begin: Location, end: Location, thickness=0.1, color: Color = (255, 0, 0), life_time=-1.0, persistent_lines=True):
"""
Draws a line on the HUD in between `begin` and `end`. The line can only be seen server-side.
Args:
begin (Location): Point in the coordinate system where the line starts (meters).
end (Location): Spot in the coordinate system where the line ends (meters).
thickness (float, optional): Density of the line. Defaults to 0.1.
color (Color, optional): RGB code to color the object. Defaults to (255,0,0).
life_time (float, optional): Shape's lifespan. By default it only lasts one frame. Set this to `0` for permanent shapes. Defaults to -1.0.
"""
...
def draw_point(self, location: Location, size=0.1, color=(255, 0, 0), life_time=-1.0, persistent_lines=True):
"""
Draws a point location.
Args:
location (Location): Spot in the coordinate system to center the object (meters).
@ -1262,7 +1309,19 @@ class DebugHelper():
"""
...
def draw_string(self, location: Location, text: str, draw_shadow=False, color: Color = (255, 0, 0), life_time=-1.0):
def draw_hud_point(self, location: Location, size=0.1, color=(255, 0, 0), life_time=-1.0, persistent_lines=True):
"""
Draws a point on the HUD at `location`. The point can only be seen server-side.
Args:
location (Location): Spot in the coordinate system to center the object (meters).
size (float, optional): Density of the point (meters). Defaults to 0.1.
color (tuple, optional): RGB code to color the object. Defaults to (255,0,0).
life_time (float, optional): Shape's lifespan. By default it only lasts one frame. Set this to 0 for permanent shapes (seconds). Defaults to -1.0.
"""
...
def draw_string(self, location: Location, text: str, draw_shadow=False, color: Color = (255, 0, 0), life_time=-1.0, persistent_lines=True):
"""Draws a string in a given location of the simulation which can only be seen server-side.
Args: