habitat.sims.habitat_simulator.actions.HabitatSimActionsSingleton class

Implements an extendable Enum for the mapping of action names to their integer values.

This means that new action names can be added, but old action names cannot be removed nor can their mapping be altered. This also ensures that all actions are always contigously mapped in [0, len(HabitatSimActions) - 1]

This accesible as the global singleton HabitatSimActions

Methods

def extend_action_space(self, name: str) -> int
Extends the action space to accommodate a new action with the name name
def has_action(self, name: str) -> bool
Checks to see if action name is already register

Special methods

def __attrs_post_init__(self)
def __getattr__(self, name)
def __getitem__(self, name)
def __init__(self) -> None
Method generated by attrs for class HabitatSimActionsSingleton.
def __iter__(self)
def __len__(self)

Method documentation

def habitat.sims.habitat_simulator.actions.HabitatSimActionsSingleton.extend_action_space(self, name: str) -> int

Extends the action space to accommodate a new action with the name name

Parameters
name The name of the new action
Returns The number the action is registered on

Usage:

from habitat.sims.habitat_simulator.actions import HabitatSimActions
HabitatSimActions.extend_action_space("MY_ACTION")
print(HabitatSimActions.MY_ACTION)

def habitat.sims.habitat_simulator.actions.HabitatSimActionsSingleton.has_action(self, name: str) -> bool

Checks to see if action name is already register

Parameters
name The name to check
Returns Whether or not name already exists