Beispiel #1
0
    def _spawn_ego_car(self, start_transform):
        """
        Spawn or update all scenario actors according to
        a certain start position.
        """
        # If ego_vehicle already exists, just update location
        # Otherwise spawn ego vehicle
        self._ego_actor = CarlaActorPool.request_new_actor(self._vehicle_model, start_transform,
                                                           hero=True)

        CarlaDataProvider.set_ego_vehicle_route( convert_transform_to_location(self._route))
        logging.debug("Created Ego Vehicle")
Beispiel #2
0
    def build_master_scenario(self, route, town_name, timeout, terminate_on_collision):
        # We have to find the target.
        # we also have to convert the route to the expected format
        master_scenario_configuration = ScenarioConfiguration()
        master_scenario_configuration.target = route[-1][0]  # Take the last point and add as target.
        master_scenario_configuration.route = convert_transform_to_location(route)

        master_scenario_configuration.town = town_name
        master_scenario_configuration.ego_vehicle = ActorConfigurationData('vehicle.lincoln.mkz2017',
                                                                           self._ego_actor.get_transform())
        master_scenario_configuration.trigger_point = self._ego_actor.get_transform()
        CarlaDataProvider.register_actor(self._ego_actor)

        return MasterScenario(self.world, [self._ego_actor], master_scenario_configuration,
                              timeout=timeout, terminate_on_collision=terminate_on_collision)