Beispiel #1
0
    def init_common(self):
        # self._cfg = make_cfg(self._sim_settings)
        scene_file = self._sim_settings["scene"]

        if (not os.path.exists(scene_file)
                and scene_file == default_sim_settings["test_scene"]):
            print(
                "Test scenes not downloaded locally, downloading and extracting now..."
            )
            utils.download_and_unzip(
                default_sim_settings["test_scene_data_url"], ".")
            print("Downloaded and extracted test scenes data.")

        # self._sim = habitat_sim.Simulator(self._cfg)
        self._sim.reset()
        random.seed(self._sim_settings["seed"])
        self._sim.seed(self._sim_settings["seed"])

        # initialize the agent at a random start state
        start_state = self.init_agent_state(
            self._sim_settings["default_agent"])
        self.initial_dist_to_goal = np.linalg.norm(start_state.position -
                                                   self.end_position)
        self.dist_to_goal = np.linalg.norm(start_state.position -
                                           self.end_position)
        self.previous_position = start_state.position
        self.agent_episode_distance = 0

        return start_state
Beispiel #2
0
    def init_common(self):
        self._cfg = make_cfg(self._sim_settings)
        scene_file = self._sim_settings["scene"]

        if (not os.path.exists(scene_file)
                and scene_file == default_sim_settings["test_scene"]):
            print(
                "Test scenes not downloaded locally, downloading and extracting now..."
            )
            utils.download_and_unzip(
                default_sim_settings["test_scene_data_url"], ".")
            print("Downloaded and extracted test scenes data.")

        self._sim = habitat_sim.Simulator(self._cfg)

        random.seed(self._sim_settings["seed"])
        self._sim.seed(self._sim_settings["seed"])

        # initialize the agent at a random start state
        start_state = self.init_agent_state(
            self._sim_settings["default_agent"])

        return start_state