Skip to content

Commit

Permalink
added documentation to python settings utilities (#1949)
Browse files Browse the repository at this point in the history
  • Loading branch information
aclegg3 authored Nov 28, 2022
1 parent 7ab0cf2 commit d830227
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
8 changes: 8 additions & 0 deletions docs/docs.rst
Original file line number Diff line number Diff line change
Expand Up @@ -181,3 181,11 @@
:start-after: # [d3_40_colors_hex]
:end-before: # [/d3_40_colors_hex]
:filters: string_hex_colors

.. py:data:: habitat_sim.utils.settings.default_sim_settings
:summary: Quickstart settings dictionary. Can be passed directly to settings.make_cfg() to create a default Configuration for an empty scene. Edit to customize the simulator.

.. include:: ../src_python/habitat_sim/utils/settings.py
:code: py
:start-after: # [default_sim_settings]
:end-before: # [/default_sim_settings]
16 changes: 15 additions & 1 deletion src_python/habitat_sim/utils/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 2,12 @@
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.

from typing import Any, Dict

import habitat_sim
import habitat_sim.agent

# [default_sim_settings]
default_sim_settings = {
"scene_dataset_config_file": "default",
"scene": "NONE",
Expand All @@ -28,9 31,20 @@
"seed": 1,
"physics_config_file": "data/default.physics_config.json",
}
# [/default_sim_settings]

# build SimulatorConfiguration
def make_cfg(settings):
def make_cfg(settings: Dict[str, Any]):
r"""Isolates the boilerplate code to create a habitat_sim.Configuration from a settings dictionary.
:param settings: A dict with pre-defined keys, each a basic simulator initialization parameter.
Allows configuration of dataset and scene, visual sensor parameters, and basic agent parameters.
Optionally creates up to one of each of a variety of aligned visual sensors under Agent 0.
The output can be passed directly into habitat_sim.simulator.Simulator constructor or reconfigure to initialize a Simulator instance.
"""
sim_cfg = habitat_sim.SimulatorConfiguration()
if "scene_dataset_config_file" in settings:
sim_cfg.scene_dataset_config_file = settings["scene_dataset_config_file"]
Expand Down

0 comments on commit d830227

Please sign in to comment.