MCPcopy Create free account
hub / github.com/OpenDriveLab/DriveAdapter / __init__

Method __init__

scenario_runner/no_rendering_mode.py:435–456  ·  view source on GitHub ↗
(self, carla_world, carla_map, pixels_per_meter, show_triggers, show_connections, show_spawn_points)

Source from the content-addressed store, hash-verified

433
434class MapImage(object):
435 def __init__(self, carla_world, carla_map, pixels_per_meter, show_triggers, show_connections, show_spawn_points):
436 self._pixels_per_meter = pixels_per_meter
437 self.scale = 1.0
438 self.show_triggers = show_triggers
439 self.show_connections = show_connections
440 self.show_spawn_points = show_spawn_points
441
442 waypoints = carla_map.generate_waypoints(2)
443 margin = 50
444 max_x = max(waypoints, key=lambda x: x.transform.location.x).transform.location.x + margin
445 max_y = max(waypoints, key=lambda x: x.transform.location.y).transform.location.y + margin
446 min_x = min(waypoints, key=lambda x: x.transform.location.x).transform.location.x - margin
447 min_y = min(waypoints, key=lambda x: x.transform.location.y).transform.location.y - margin
448
449 self.width = max(max_x - min_x, max_y - min_y)
450 self._world_offset = (min_x, min_y)
451
452 width_in_pixels = int(self._pixels_per_meter * self.width)
453
454 self.big_map_surface = pygame.Surface((width_in_pixels, width_in_pixels)).convert()
455 self.draw_road_map(self.big_map_surface, carla_world, carla_map, self.world_to_pixel, self.world_to_pixel_width)
456 self.surface = self.big_map_surface
457
458 def draw_road_map(self, map_surface, carla_world, carla_map, world_to_pixel, world_to_pixel_width):
459 map_surface.fill(COLOR_ALUMINIUM_4)

Callers

nothing calls this directly

Calls 1

draw_road_mapMethod · 0.95

Tested by

no test coverage detected