Exemple #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["scene"]):
            print(
                "Test scenes not downloaded locally, downloading and extracting now..."
            )
            download_and_unzip(default_sim_settings["test_scene_data_url"],
                               ".")
            print("Downloaded and extracted test scenes data.")

        # create a simulator (Simulator python class object, not the backend simulator)
        self._sim = habitat_sim.Simulator(self._cfg)

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

        recompute_navmesh = self._sim_settings.get("recompute_navmesh")
        if recompute_navmesh or not self._sim.pathfinder.is_loaded:
            if not self._sim_settings["silent"]:
                print("Recomputing navmesh")
            navmesh_settings = habitat_sim.NavMeshSettings()
            navmesh_settings.set_defaults()
            self._sim.recompute_navmesh(self._sim.pathfinder, navmesh_settings)

        # initialize the agent at a random start state
        return self.init_agent_state(self._sim_settings["default_agent"])
    def init_common(self):
        self._cfg = make_cfg(self._sim_settings)
        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
 def __init__(self, folder, init_state, depth_type):
     scene_glb = folder + "/" + os.path.basename(
         folder).capitalize() + ".glb"
     self._cfg = make_cfg(scene_glb)
     self.init_common(init_state)
     self.depth_type = depth_type
     agent_node = self._sim.agents[0].scene_node
     self.agent_object_id = self._sim.add_object(1, agent_node)
     self._sim.set_object_motion_type(
         habitat_sim.physics.MotionType.KINEMATIC, self.agent_object_id)
     assert (self._sim.get_object_motion_type(
         self.agent_object_id) == habitat_sim.physics.MotionType.KINEMATIC)
     # Saving Start Frame
     observations = self._sim.get_sensor_observations()
     self.save_color_observation(observations, 0, 0, folder)
     self.save_depth_observation(observations, 0, 0, folder)
Exemple #4
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
    def __init__(self, folder, init_state, depth_type):
        scene_glb = folder + "/" + os.path.basename(
            folder).capitalize() + ".glb"
        self._cfg = make_cfg(scene_glb)
        self.init_common(init_state)
        self.depth_type = depth_type
        agent_node = self._sim.agents[0].scene_node
        self.agent_object_id = self._sim.add_object(1, agent_node)
        self._sim.set_object_motion_type(
            habitat_sim.physics.MotionType.KINEMATIC, self.agent_object_id)
        assert (self._sim.get_object_motion_type(
            self.agent_object_id) == habitat_sim.physics.MotionType.KINEMATIC)
        # Saving Start Frame
        observations = self._sim.get_sensor_observations()
        self.save_color_observation(observations, 0, 0, folder)
        self.save_depth_observation(observations, 0, 0, folder)

        self.noise = False
        self.translation_noise = pickle.load(
            open("actuation_noise_fwd.pkl", 'rb'))
        self.rotation_left_noise = pickle.load(
            open("actuation_noise_left.pkl", 'rb'))
        self.rotation_right_noise = pickle.load(
            open("actuation_noise_right.pkl", 'rb'))