leaderboard/leaderboard/leaderboard_evaluator.py
def _prepare_ego_vehicles(self, ego_vehicles, wait_for_ego_vehicles=False):
        """
        Spawn or update the ego vehicles
        """

        if not wait_for_ego_vehicles:
            for vehicle in ego_vehicles:
                self.ego_vehicles.append(CarlaDataProvider.request_new_actor(vehicle.model,
                                                                             vehicle.transform,
                                                                             vehicle.rolename,
                                                                             color=vehicle.color,
                                                                             vehicle_category=vehicle.category))

        else:
            ego_vehicle_missing = True
            while ego_vehicle_missing:
                self.ego_vehicles = []
                ego_vehicle_missing = False
                for ego_vehicle in ego_vehicles:
                    ego_vehicle_found = False
                    carla_vehicles = CarlaDataProvider.get_world().get_actors().filter('vehicle.*')
                    for carla_vehicle in carla_vehicles:
                        if carla_vehicle.attributes['role_name'] == ego_vehicle.rolename:
                            ego_vehicle_found = True
                            self.ego_vehicles.append(carla_vehicle)
                            break
                    if not ego_vehicle_found:
                        ego_vehicle_missing = True
                        break

            for i, _ in enumerate(self.ego_vehicles):
                self.ego_vehicles[i].set_transform(ego_vehicles[i].transform)

        # sync state
        CarlaDataProvider.get_world().tick()

        Spawn or update the ego vehicles
        
Spawn or update the ego vehicles
Spawn or update the ego vehicles
def _prepare_ego_vehicles(self, ego_vehicles, wait_for_ego_vehicles=False):
        if not wait_for_ego_vehicles:
            for vehicle in ego_vehicles:
                self.ego_vehicles.append(CarlaDataProvider.request_new_actor(vehicle.model,
                                                                             vehicle.transform,
                                                                             vehicle.rolename,
                                                                             color=vehicle.color,
                                                                             vehicle_category=vehicle.category))
        else:
            ego_vehicle_missing = True
            while ego_vehicle_missing:
                self.ego_vehicles = []
                ego_vehicle_missing = False
                for ego_vehicle in ego_vehicles:
                    ego_vehicle_found = False
                    carla_vehicles = CarlaDataProvider.get_world().get_actors().filter('vehicle.*')
                    for carla_vehicle in carla_vehicles:
                        if carla_vehicle.attributes['role_name'] == ego_vehicle.rolename:
                            ego_vehicle_found = True
                            self.ego_vehicles.append(carla_vehicle)
                            break
                    if not ego_vehicle_found:
                        ego_vehicle_missing = True
                        break
            for i, _ in enumerate(self.ego_vehicles):
                self.ego_vehicles[i].set_transform(ego_vehicles[i].transform)
        CarlaDataProvider.get_world().tick()
def _prepare_ego_vehicles ( self , ego_vehicles , wait_for_ego_vehicles = False ) : if not wait_for_ego_vehicles : for vehicle in ego_vehicles : self . ego_vehicles . append ( CarlaDataProvider . request_new_actor ( vehicle . model , vehicle . transform , vehicle . rolename , color = vehicle . color , vehicle_category = vehicle . category ) ) else : ego_vehicle_missing = True while ego_vehicle_missing : self . ego_vehicles = [ ] ego_vehicle_missing = False for ego_vehicle in ego_vehicles : ego_vehicle_found = False carla_vehicles = CarlaDataProvider . get_world ( ) . get_actors ( ) . filter ( 'vehicle.*' ) for carla_vehicle in carla_vehicles : if carla_vehicle . attributes [ 'role_name' ] == ego_vehicle . rolename : ego_vehicle_found = True self . ego_vehicles . append ( carla_vehicle ) break if not ego_vehicle_found : ego_vehicle_missing = True break for i , _ in enumerate ( self . ego_vehicles ) : self . ego_vehicles [ i ] . set_transform ( ego_vehicles [ i ] . transform ) CarlaDataProvider . get_world ( ) . tick ( )
Spawn or update the ego vehicles
Spawn or update the ego vehicles
"""
        Spawn or update the ego vehicles
        """ # sync state
self
ego_vehicles
wait_for_ego_vehicles