Esempio n. 1
0
    def test_scenario_track_info(self):
        map_filename = os.path.join(
            os.path.dirname(__file__),
            "../runtime/tests/data/DR_DEU_Merging_MT_v01_shifted.xodr")
        track_filename = os.path.join(
            os.path.dirname(__file__),
            "../runtime/tests/data/interaction_dataset_dummy_track.csv")

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

        print(agent1)

        agent2 = AgentTrackInfo(track_filename,
                                track_id=2,
                                start_offset=500,
                                end_offset=1000)

        print(agent2)

        scen_info = ScenarioTrackInfo(map_filename,
                                      track_filename,
                                      agent1,
                                      xy_offset=[0, 0],
                                      start_ts=500,
                                      end_ts=1000)
        scen_info.AddTrackInfoOtherAgent(agent2)

        print(scen_info)

        assert (scen_info.TimeSanityCheck() == True)
Esempio n. 2
0
    def __fill_scenario_track_info__(self):
        if self._ego_track_id == -1:
            raise ValueError("No ego id has been defined")

        ego_track_info = AgentTrackInfo(filename=self._track_file_name, track_id=self._ego_track_id,
                                        start_time=self._start_time, end_time=self._end_time)
        scenario_track_info = ScenarioTrackInfo(track_filename=self._track_file_name, ego_track_info=ego_track_info, xy_offset=self._xy_offset)
        for track_id in self._track_ids:
            new_agent = AgentTrackInfo(filename=self._track_file_name, track_id=track_id,
                                       start_time=self._start_time, end_time=self._end_time)
            scenario_track_info.AddTrackInfoOtherAgent(new_agent)

        return scenario_track_info
Esempio n. 3
0
    def __find_all_scenarios__(self):
        scenario_list = []
        for id_ego in self._agents_track_infos.keys():
            ego_track_info = self.__get_agent_track_info__(id_ego)
            new_scenario = ScenarioTrackInfo(
                map_filename=self._map_filename, track_filename=self._track_filename, ego_track_info=ego_track_info)

            ids_others = self.__find_all_ids__(id_ego)
            for id_o in ids_others:
                agent_o_track_info = self.__get_agent_track_info__(id_o)
                new_scenario.AddTrackInfoOtherAgent(agent_o_track_info)
                
            scenario_list.append(new_scenario)

        return scenario_list
Esempio n. 4
0
    def test_agent_from_trackfile_centered(self):

        map_filename = os.path.join(
            os.path.dirname(__file__),
            "../tests/data/DR_DEU_Merging_MT_v01_centered.xodr")
        track_filename = os.path.join(
            os.path.dirname(__file__),
            "../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", "", map_filename]
        params_id["TrackFilename", "", track_filename]
        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,
                                          xy_offset=[-900, -900])
        ds_reader = InteractionDatasetReader()
        agent = ds_reader.AgentFromTrackfile(track_params, params,
                                             scenario_info,
                                             agent_track_info.GetTrackId())