def _build_master_scenario(self,
                               world,
                               ego_vehicle,
                               route,
                               town_name,
                               timeout=300,
                               debug_mode=False):
        """
        Create the MasterScenario
        """
        # 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
        # TODO THIS NAME IS BIT WEIRD SINCE THE EGO VEHICLE  IS ALREADY THERE, IT IS MORE ABOUT THE TRANSFORM
        master_scenario_configuration.ego_vehicle = ActorConfigurationData(
            'vehicle.lincoln.mkz2017', ego_vehicle.get_transform(), 'hero')
        master_scenario_configuration.trigger_points = [
            ego_vehicle.get_transform()
        ]

        # Provide an initial blackboard entry to ensure all scenarios are running correctly
        blackboard = py_trees.blackboard.Blackboard()
        blackboard.set('master_scenario_command', 'scenarios_running')

        return MasterScenario(world, [ego_vehicle],
                              master_scenario_configuration,
                              timeout=timeout,
                              debug_mode=debug_mode)
Esempio n. 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)