Implementation:Facebookresearch Habitat lab HITL HydraUtils
| Knowledge Sources | |
|---|---|
| Domains | Embodied_AI, Human_in_the_Loop |
| Last Updated | 2026-02-15 00:00 GMT |
Overview
HITL_HydraUtils provides Hydra configuration plugin registration and a utility function for converting OmegaConf configuration objects to plain Python objects for faster runtime field access.
Description
This module contains three key components:
- HabitatHitlConfigPlugin: A Hydra SearchPathPlugin that appends the habitat_hitl/config package path to the Hydra configuration search path, enabling HITL-specific configuration files to be discovered.
- register_hydra_plugins(): A convenience function that registers the Habitat, Habitat-Baselines, and Habitat-HITL Hydra config plugins in one call.
- omegaconf_to_object(): A recursive function that converts an OmegaConf DictConfig or ListConfig into plain Python objects (ConfigObject instances with attribute access, or lists). This conversion eliminates the approximately 50x overhead of accessing OmegaConf config fields at runtime versus plain Python object attributes.
The helper class ConfigObject is a simple dynamic object that converts dictionary entries into instance attributes via __dict__.update.
Usage
Use register_hydra_plugins() at application startup to ensure all Habitat configuration search paths are registered. Use omegaconf_to_object() to convert OmegaConf configuration to fast Python objects when config fields will be accessed frequently at runtime.
Code Reference
Source Location
- Repository: Facebookresearch_Habitat_lab
- File: habitat-hitl/habitat_hitl/core/hydra_utils.py
- Lines: 1-61
Signature
class HabitatHitlConfigPlugin(SearchPathPlugin):
def manipulate_search_path(self, search_path: ConfigSearchPath) -> None:
...
def register_hydra_plugins():
...
class ConfigObject:
def __init__(self, **entries):
...
def omegaconf_to_object(cfg):
...
Import
from habitat_hitl.core.hydra_utils import (
HabitatHitlConfigPlugin,
register_hydra_plugins,
omegaconf_to_object,
ConfigObject,
)
I/O Contract
Inputs (omegaconf_to_object)
| Name | Type | Required | Description |
|---|---|---|---|
| cfg | omegaconf.Config (DictConfig, ListConfig, or primitive) | Yes | The OmegaConf configuration to convert to a Python object. |
Outputs (omegaconf_to_object)
| Name | Type | Description |
|---|---|---|
| return value | ConfigObject, list, or primitive | A Python object representing the configuration. DictConfig becomes ConfigObject with attribute access, ListConfig becomes a list, and primitives are returned as-is. |
Usage Examples
Registering Hydra Plugins
from habitat_hitl.core.hydra_utils import register_hydra_plugins
# Register all Habitat Hydra plugins at startup
register_hydra_plugins()
Converting OmegaConf to Python Objects
from omegaconf import DictConfig
from habitat_hitl.core.hydra_utils import omegaconf_to_object
# Given an OmegaConf config
cfg = DictConfig({
"networking": {
"enable": True,
"port": 8080,
},
"agents": [{"name": "agent_0"}, {"name": "agent_1"}],
})
# Convert to fast Python objects
obj = omegaconf_to_object(cfg)
# Access fields as attributes (much faster than OmegaConf access)
print(obj.networking.enable) # True
print(obj.networking.port) # 8080
print(obj.agents[0].name) # "agent_0"