Principle:Facebookresearch Habitat lab Component Class Definition
| Knowledge Sources | |
|---|---|
| Domains | Software_Architecture, Embodied_AI |
| Last Updated | 2026-02-15 02:00 GMT |
Overview
The abstract base class pattern for defining custom sensors, measures, and actions that extend the Habitat task framework.
Description
Component Class Definition is the first step in extending Habitat-Lab with custom functionality. Habitat provides three base classes that users subclass:
- Sensor: Produces observations (e.g., custom image transforms, semantic labels, task-specific signals)
- Measure: Computes evaluation metrics (e.g., custom success criteria, progress metrics)
- SimulatorTaskAction: Defines new agent actions (e.g., custom movement, interaction)
Each base class defines abstract methods that the subclass must implement to specify the component's UUID (unique identifier), observation/metric space, and the core computation logic.
Usage
Use when the built-in Habitat sensors, measures, or actions do not cover your task requirements. This is the standard extension mechanism for adding custom task logic.
Theoretical Basis
The component system follows the Template Method pattern:
- UUID: Unique string identifier used in config and registry lookup
- Space/Type: Defines the shape and type of the output (observations or metrics)
- Compute: The core logic that produces the output given simulator state and episode context
# Abstract component interface
class Component(ABC):
def _get_uuid(self) -> str: ... # Unique identifier
def _get_observation_space(self) -> Space: ... # Output shape/type
def get_observation(self, **kwargs) -> Any: ... # Core logic