importhabitat_simimportrandom%matplotlibinlineimportmatplotlib.pyplotaspltimportnumpyasnptest_scene="../data/scene_datasets/mp3d/17DRP5sb8fy/17DRP5sb8fy.glb"sim_settings={"width":256,# Spatial resolution of the observations"height":256,"scene":test_scene,# Scene path"default_agent":0,"sensor_height":1.5,# Height of sensors in meters"color_sensor":True,# RGB sensor"semantic_sensor":True,# Semantic sensor"depth_sensor":True,# Depth sensor"seed":1,}
defmake_cfg(settings):sim_cfg=habitat_sim.SimulatorConfiguration()sim_cfg.gpu_device_id=0sim_cfg.scene.id=settings["scene"]# Note: all sensors must have the same resolutionsensors={"color_sensor":{"sensor_type":habitat_sim.SensorType.COLOR,"resolution":[settings["height"],settings["width"]],"position":[0.0,settings["sensor_height"],0.0],},"depth_sensor":{"sensor_type":habitat_sim.SensorType.DEPTH,"resolution":[settings["height"],settings["width"]],"position":[0.0,settings["sensor_height"],0.0],},"semantic_sensor":{"sensor_type":habitat_sim.SensorType.SEMANTIC,"resolution":[settings["height"],settings["width"]],"position":[0.0,settings["sensor_height"],0.0],},}sensor_specs=[]forsensor_uuid,sensor_paramsinsensors.items():ifsettings[sensor_uuid]:sensor_spec=habitat_sim.SensorSpec()sensor_spec.uuid=sensor_uuidsensor_spec.sensor_type=sensor_params["sensor_type"]sensor_spec.resolution=sensor_params["resolution"]sensor_spec.position=sensor_params["position"]sensor_specs.append(sensor_spec)# Here you can specify the amount of displacement in a forward action and the turn angleagent_cfg=habitat_sim.agent.AgentConfiguration()agent_cfg.sensor_specifications=sensor_specsagent_cfg.action_space={"move_forward":habitat_sim.agent.ActionSpec("move_forward",habitat_sim.agent.ActuationSpec(amount=0.25)),"turn_left":habitat_sim.agent.ActionSpec("turn_left",habitat_sim.agent.ActuationSpec(amount=30.0)),"turn_right":habitat_sim.agent.ActionSpec("turn_right",habitat_sim.agent.ActuationSpec(amount=30.0)),}returnhabitat_sim.Configuration(sim_cfg,[agent_cfg])cfg=make_cfg(sim_settings)sim=habitat_sim.Simulator(cfg)
Search for modules, classes, functions and other
symbols. You can omit any prefix from the symbol path; adding a .
suffix lists all members of given symbol.
Use ↓
/ ↑ to navigate through the list,
Enter to go.
Tab autocompletes common prefix, you can
copy a link to the result using ⌘L while ⌘M produces a Markdown link.