MCPcopy Create free account
hub / github.com/AdaCompNUS/summit / draw_junction

Function draw_junction

PythonAPI/util/lane_explorer.py:64–95  ·  view source on GitHub ↗

Draws a junction bounding box and the initial and final waypoint of every lane.

(debug, junction, l_time=10)

Source from the content-addressed store, hash-verified

62 debug.draw_string(w_loc + carla.Location(z=-.5), str(w.lane_change), False, red, lt)
63
64def draw_junction(debug, junction, l_time=10):
65 """Draws a junction bounding box and the initial and final waypoint of every lane."""
66 # draw bounding box
67 box = junction.bounding_box
68 point1 = box.location + carla.Location(x=box.extent.x, y=box.extent.y, z=2)
69 point2 = box.location + carla.Location(x=-box.extent.x, y=box.extent.y, z=2)
70 point3 = box.location + carla.Location(x=-box.extent.x, y=-box.extent.y, z=2)
71 point4 = box.location + carla.Location(x=box.extent.x, y=-box.extent.y, z=2)
72 debug.draw_line(
73 point1, point2,
74 thickness=0.1, color=orange, life_time=l_time, persistent_lines=False)
75 debug.draw_line(
76 point2, point3,
77 thickness=0.1, color=orange, life_time=l_time, persistent_lines=False)
78 debug.draw_line(
79 point3, point4,
80 thickness=0.1, color=orange, life_time=l_time, persistent_lines=False)
81 debug.draw_line(
82 point4, point1,
83 thickness=0.1, color=orange, life_time=l_time, persistent_lines=False)
84 # draw junction pairs (begin-end) of every lane
85 junction_w = junction.get_waypoints(carla.LaneType.Any)
86 for pair_w in junction_w:
87 draw_transform(debug, pair_w[0].transform, orange, l_time)
88 debug.draw_point(
89 pair_w[0].transform.location + carla.Location(z=0.75), 0.1, orange, l_time, False)
90 draw_transform(debug, pair_w[1].transform, orange, l_time)
91 debug.draw_point(
92 pair_w[1].transform.location + carla.Location(z=0.75), 0.1, orange, l_time, False)
93 debug.draw_line(
94 pair_w[0].transform.location + carla.Location(z=0.75),
95 pair_w[1].transform.location + carla.Location(z=0.75), 0.1, white, l_time, False)
96
97def main():
98 argparser = argparse.ArgumentParser()

Callers 1

mainFunction · 0.85

Calls 2

draw_transformFunction · 0.85
LocationMethod · 0.45

Tested by

no test coverage detected