예제 #1
0
    def create_single_scenario(self):
        scenario = Scenario(map_file_name=self._map_file_name,
                            json_params=self._params.convert_to_dict())
        world = scenario.get_world_state()
        agent_list = []
        eval_agent_ids = []
        track_params = ParameterServer()
        track_params["filename"] = self._track_file_name
        track_params["execution_model"] = 'ExecutionModelInterpolate'
        track_params["dynamic_model"] = 'SingleTrackModel'
        track_params["map_interface"] = world.map
        track_params["start_offset"] = self.start_time
        track_params["end_offset"] = self.end_time
        for track_id in self._track_ids:
            track_params["track_id"] = track_id
            if str(track_id) in self.behavior_models:
                track_params["behavior_model"] = self.behavior_models[str(track_id)]
            else:
                track_params["behavior_model"] = None
            agent = agent_from_trackfile(track_params, self._params, track_id)
            agent_list.append(agent)
            if track_id == self.ego_track_id:
                eval_agent_ids = [agent.id]
        scenario._agent_list = agent_list

        scenario._eval_agent_ids = eval_agent_ids
        return scenario
예제 #2
0
  def test_agent_from_trackfile(self):

    track_ids = [1, 2, 3]

    params = ParameterServer()
    params_id = params["Scenario"]["Generation"]["InteractionDataset"]
    params_id["MapFilename", "", "modules/runtime/tests/data/DR_DEU_Merging_MT_v01_shifted.xodr"]
    params_id["TrackFilename", "", "modules/runtime/tests/data/interaction_dataset_dummy_track.csv"]
    params_id["TrackIds", "", track_ids]
    params_id["StartTs", "", 100]
    params_id["EndTs", "", None]
    params_id["EgoTrackId", "", -1]
    params_id["BehaviorModel", "", {}]

    track_params = ParameterServer()
    track_params["filename"] = params["Scenario"]["Generation"]["InteractionDataset"]["TrackFilename"]
    track_params["execution_model"] = 'ExecutionModelInterpolate'
    track_params["dynamic_model"] = 'SingleTrackModel'
    track_params["map_interface"] = None # world.map
    track_params["start_offset"] = params["Scenario"]["Generation"]["InteractionDataset"]["StartTs"]
    track_params["end_offset"] = params["Scenario"]["Generation"]["InteractionDataset"]["EndTs"]
    track_params["behavior_model"] = None

    agent_list = []
    for track_id in track_ids:
      track_params["track_id"] = track_id 
      agent = agent_from_trackfile(track_params, params, 1)
      agent_list.append(agent)
      print(agent.behavior_model)
      
    assert(len(agent_list) == len(track_ids))
    def test_agent_from_trackfile(self):

        map_filename = "modules/runtime/tests/data/DR_DEU_Merging_MT_v01_shifted.xodr"
        track_filename = "modules/runtime/tests/data/interaction_dataset_dummy_track.csv"

        agent_track_info = AgentTrackInfo(track_filename,
                                          track_id=1,
                                          start_offset=500,
                                          end_offset=1000)

        params = ParameterServer()
        params_id = params["Scenario"]["Generation"]["InteractionDataset"]
        params_id[
            "MapFilename", "",
            "modules/runtime/tests/data/DR_DEU_Merging_MT_v01_shifted.xodr"]
        params_id[
            "TrackFilename", "",
            "modules/runtime/tests/data/interaction_dataset_dummy_track.csv"]
        params_id["BehaviorModel", "", {}]

        track_params = ParameterServer()
        track_params["execution_model"] = 'ExecutionModelInterpolate'
        track_params["dynamic_model"] = 'SingleTrackModel'
        track_params["map_interface"] = None  # world.map
        track_params["behavior_model"] = None

        scenario_info = ScenarioTrackInfo(map_filename, track_filename,
                                          agent_track_info)

        agent = agent_from_trackfile(track_params, params, scenario_info,
                                     agent_track_info.GetTrackId())
예제 #4
0
    def __create_single_scenario__(self, scenario_track_info):
        scenario_track_info.TimeSanityCheck()

        scenario = Scenario(map_file_name=self._map_file_name,
                            json_params=self._params.ConvertToDict())
        world = scenario.GetWorldState()
        agent_list = []
        track_params = ParameterServer()
        track_params["execution_model"] = 'ExecutionModelInterpolate'
        track_params["dynamic_model"] = 'SingleTrackModel'
        track_params["map_interface"] = world.map

        for id_other in scenario_track_info.GetOtherTrackInfos().keys():
            if str(id_other) in self._behavior_models:
                track_params["behavior_model"] = self._behavior_models[str(
                    id_other)]
            else:
                track_params["behavior_model"] = None
            agent = agent_from_trackfile(track_params, self._params,
                                         scenario_track_info, id_other)
            agent_list.append(agent)

        id_ego = scenario_track_info.GetEgoTrackInfo().GetTrackId()
        if str(id_ego) in self._behavior_models:
            track_params["behavior_model"] = self._behavior_models[str(id_ego)]
        else:
            track_params["behavior_model"] = None
        agent = agent_from_trackfile(track_params, self._params,
                                     scenario_track_info, id_ego)
        agent_list.append(agent)

        scenario._agent_list = agent_list  # must contain all agents!
        scenario._eval_agent_ids = [
            scenario_track_info.GetEgoTrackInfo().GetTrackId()
        ]

        return scenario