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

Method select_hero_actor

scenario_runner/no_rendering_mode.py:888–895  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

886 self.world.on_tick(lambda timestamp: ModuleWorld.on_world_tick(weak_self, timestamp))
887
888 def select_hero_actor(self):
889 hero_vehicles = [actor for actor in self.world.get_actors(
890 ) if 'vehicle' in actor.type_id and actor.attributes['role_name'] == 'hero']
891 if len(hero_vehicles) > 0:
892 self.hero_actor = random.choice(hero_vehicles)
893 self.hero_transform = self.hero_actor.get_transform()
894 else:
895 self._spawn_hero()
896
897 def _spawn_hero(self):
898 # Get a random blueprint.

Callers 2

startMethod · 0.95
_parse_eventsMethod · 0.80

Calls 3

_spawn_heroMethod · 0.95
get_actorsMethod · 0.80
get_transformMethod · 0.80

Tested by

no test coverage detected