habitat.sims.habitat_simulator.object_state_machine.ObjectStateMachine class

Defines the logic for managing multiple states across all objects in the scene.

Methods

def get_snapshot_dict(self, sim: habitat_sim.simulator.Simulator) -> typing.Dict[str, typing.Dict[str, typing.Any]]
Scrape all active ObjectStateSpecs to collect a snapshot of the current state of all objects.
def initialize_object_state_map(self, sim: habitat_sim.simulator.Simulator) -> None
Reset the objects_with_states dict and re-initializes it by parsing all objects from the scene and checking is_affordance_of_obj for all active ObjectStateSpecs.
def register_object(self, obj: typing.Union[habitat_sim._ext.habitat_sim_bindings.ManagedArticulatedObject, habitat_sim._ext.habitat_sim_bindings.ManagedRigidObject]) -> None
Register a single object in the ‘objects_with_states’ dict by checking ‘is_affordance_of_obj’ for all active ObjectStateSpecs. Use this when a new object is added to the scene and needs to be registered.
def update_states(self, sim: habitat_sim.simulator.Simulator, dt: float) -> None
Update all tracked object states for a simulation step.

Special methods

def __init__(self, active_states: typing.Optional[typing.List[ObjectStateSpec]] = None) -> None

Method documentation

def habitat.sims.habitat_simulator.object_state_machine.ObjectStateMachine.get_snapshot_dict(self, sim: habitat_sim.simulator.Simulator) -> typing.Dict[str, typing.Dict[str, typing.Any]]

Scrape all active ObjectStateSpecs to collect a snapshot of the current state of all objects.

Parameters
sim The Simulator instance for which to collect and return current object states.
Returns The state snapshot as a Dict keyed by object state unique name, value is another dict mapping object instance handles to state values.
Example:
>>> {
>>>     "is_powered_on": {
>>>         "my_lamp.0001": True,
>>>         "my_oven": False,
>>>         ...
>>>     },
>>>     "is_clean": {
>>>         "my_dish.0002:" False,
>>>         ...
>>>     },
>>>     ...
>>> }

def habitat.sims.habitat_simulator.object_state_machine.ObjectStateMachine.initialize_object_state_map(self, sim: habitat_sim.simulator.Simulator) -> None

Reset the objects_with_states dict and re-initializes it by parsing all objects from the scene and checking is_affordance_of_obj for all active ObjectStateSpecs.

Parameters
sim The Simulator instance.

def habitat.sims.habitat_simulator.object_state_machine.ObjectStateMachine.register_object(self, obj: typing.Union[habitat_sim._ext.habitat_sim_bindings.ManagedArticulatedObject, habitat_sim._ext.habitat_sim_bindings.ManagedRigidObject]) -> None

Register a single object in the ‘objects_with_states’ dict by checking ‘is_affordance_of_obj’ for all active ObjectStateSpecs. Use this when a new object is added to the scene and needs to be registered.

Parameters
obj The ManagedObject instance to register.

def habitat.sims.habitat_simulator.object_state_machine.ObjectStateMachine.update_states(self, sim: habitat_sim.simulator.Simulator, dt: float) -> None

Update all tracked object states for a simulation step.

Parameters
sim The Simulator instance.
dt The timestep over which to update continuous states. Typically the time between calls to this function.