MCPcopy Create free account
hub / github.com/OpenDriveLab/TCP / _render_vehicles

Method _render_vehicles

scenario_runner/no_rendering_mode.py:1090–1109  ·  view source on GitHub ↗
(self, surface, list_v, world_to_pixel)

Source from the content-addressed store, hash-verified

1088 pygame.draw.polygon(surface, color, corners)
1089
1090 def _render_vehicles(self, surface, list_v, world_to_pixel):
1091
1092 for v in list_v:
1093 color = COLOR_SKY_BLUE_0
1094 if int(v[0].attributes['number_of_wheels']) == 2:
1095 color = COLOR_CHOCOLATE_1
1096 if v[0].attributes['role_name'] == 'hero':
1097 color = COLOR_CHAMELEON_0
1098 # Compute bounding box points
1099 bb = v[0].bounding_box.extent
1100 corners = [carla.Location(x=-bb.x, y=-bb.y),
1101 carla.Location(x=bb.x - 0.8, y=-bb.y),
1102 carla.Location(x=bb.x, y=0),
1103 carla.Location(x=bb.x - 0.8, y=bb.y),
1104 carla.Location(x=-bb.x, y=bb.y),
1105 carla.Location(x=-bb.x, y=-bb.y)
1106 ]
1107 v[1].transform(corners)
1108 corners = [world_to_pixel(p) for p in corners]
1109 pygame.draw.lines(surface, color, False, corners, int(math.ceil(4.0 * self.map_image.scale)))
1110
1111 def render_actors(self, surface, vehicles, traffic_lights, speed_limits, walkers):
1112 # Static actors

Callers 1

render_actorsMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected