habitat-lab icon indicating copy to clipboard operation
habitat-lab copied to clipboard

How to set custom goal position/starting position for agent in Habitat lab?

Open azhannaqeeb opened this issue 1 year ago • 3 comments

I am new to habitat and I want to train an agent using RL in habitat lab. I tried already built in examples like shortest path follower but I am unable to find where I can change or provide starting/goal position for my agent. For each episode it starts from random position and ends at random goal. I want to find some configuration file where I can set these values for shortest path follower or any other script.

azhannaqeeb avatar Aug 28 '23 06:08 azhannaqeeb

Tested for habitat-sim and habitat-lab 0.2.4

# import ...
scene = "cV4RVeZvu5T"
start_position = [6.25073, -0.881531, 9.50275]

config = habitat.get_config("config/point_nav.yaml")
with read_write(config):
    config.habitat.simulator.scene = os.path.join(config.habitat.dataset.scenes_dir, f"mp3d/{scene}/{scene}.glb")

rotation_quaternion = habitat_sim.utils.common.quat_from_angle_axis(np.pi, np.array([0, 1, 0]))

sim = make_sim(id_sim=config.habitat.simulator.type, config=config.habitat.simulator)

sim.set_agent_state(start_position, rotation_quaternion)

francescotaioli avatar Aug 31 '23 08:08 francescotaioli

@francescotaioli is there a way to set a goal semantically? for example, set start location to be the kitchen and goal location to be the bedroom?

vantony1 avatar Apr 29 '24 22:04 vantony1

@vantony1, you can try to query the Simulator for the region and check the attributes. Maybe this could be useful: https://aihabitat.org/docs/habitat-sim/habitat_sim.scene.SemanticRegion.html

francescotaioli avatar Apr 30 '24 08:04 francescotaioli