def _setup_scenario_trigger(self, config): """ This function creates a trigger maneuver, that has to be finished before the real scenario starts. This implementation focuses on the first available ego vehicle. The function can be overloaded by a user implementation inside the user-defined scenario class. """ start_location = None if config.trigger_points and config.trigger_points[0]: start_location = config.trigger_points[ 0].location # start location of the scenario ego_vehicle_route = CarlaDataProvider.get_ego_vehicle_route() if start_location: if ego_vehicle_route: if config.route_var_name is None: # pylint: disable=no-else-return return conditions.InTriggerDistanceToLocationAlongRoute( self.ego_vehicles[0], ego_vehicle_route, start_location, 5) else: check_name = "WaitForBlackboardVariable: {}".format( config.route_var_name) return conditions.WaitForBlackboardVariable( name=check_name, variable_name=config.route_var_name, variable_value=True, var_init_value=False) return conditions.InTimeToArrivalToLocation( self.ego_vehicles[0], 2.0, start_location) return None
def _setup_scenario_trigger(self, config): start_location = None if config.trigger_points and config.trigger_points[0]: # start_waypoint, _ = get_waypoint_in_distance(self._map.get_waypoint(config.trigger_points[0].location), 10) start_location = config.trigger_points[ 0].location # start_waypoint.transform.location # print("start location set to: {}, {}, {}".format(start_location.x, start_location.y, start_location.z)) ego_vehicle_route = CarlaDataProvider.get_ego_vehicle_route() if start_location: if ego_vehicle_route: if config.route_var_name is None: # pylint: disable=no-else-return return conditions.InTriggerDistanceToLocationAlongRoute( self.ego_vehicles[0], ego_vehicle_route, start_location, 5) else: check_name = "WaitForBlackboardVariable: {}".format( config.route_var_name) return conditions.WaitForBlackboardVariable( name=check_name, variable_name=config.route_var_name, variable_value=True, var_init_value=False) return conditions.InTimeToArrivalToLocation( self.ego_vehicles[0], 2.0, start_location) return None