habitat.sims.habitat_simulator.kinematic_relationship_manager.RelationshipGraph class

Uses two dictionaries to simulate a bi-directional tree relationship between objects.

NOTE: All ‘obj’ ints are assumed to be object ids so that links can be supported in the tree structure. NOTE: because links are parented explicitly to their parent AO, we don’t allow them to be children in the relationship manager, only parents.

Methods

def add_relation(self, parent: int, child: int, rel_type: str) -> None
Add a relationship connection between two objects.
def get_human_readable_relationship_forest(self, sim: habitat_sim.simulator.Simulator, do_print: bool = False) -> typing.Dict[str, typing.List[typing.Tuple[str, str]]]
Get a version of the relationship forest with human readable strings in place of object ids.
def get_root_parents(self) -> typing.List[int]
Get a list of root objects: those which are parents but have no parents.
def remove_obj_relations(self, obj: int, parents_only: bool = False) -> None
Remove all relationships for the object. Use this to remove an object from the kinematic manager. Examples: an object is picked/grasped or object is removed from simulation.
def remove_relation(self, parent: int, child: int) -> None
Remove any relationship between the pair of objects.

Special methods

def __init__(self) -> None

Method documentation

def habitat.sims.habitat_simulator.kinematic_relationship_manager.RelationshipGraph.add_relation(self, parent: int, child: int, rel_type: str) -> None

Add a relationship connection between two objects.

Parameters
parent The parent object_id.
child The child object_id.
rel_type The type string for the relationship.

def habitat.sims.habitat_simulator.kinematic_relationship_manager.RelationshipGraph.get_human_readable_relationship_forest(self, sim: habitat_sim.simulator.Simulator, do_print: bool = False) -> typing.Dict[str, typing.List[typing.Tuple[str, str]]]

Get a version of the relationship forest with human readable strings in place of object ids.

Parameters
sim We need the Simulator instance to fetch the name strings.
do_print If true, print the relationship forest nicely in addition to returning it.

def habitat.sims.habitat_simulator.kinematic_relationship_manager.RelationshipGraph.get_root_parents(self) -> typing.List[int]

Get a list of root objects: those which are parents but have no parents.

Returns A list of object_ids.

def habitat.sims.habitat_simulator.kinematic_relationship_manager.RelationshipGraph.remove_obj_relations(self, obj: int, parents_only: bool = False) -> None

Remove all relationships for the object. Use this to remove an object from the kinematic manager. Examples: an object is picked/grasped or object is removed from simulation.

Parameters
obj
parents_only If set, remove only the upward relationships (parents) of the object. This maintains child relationships. For example, use this to move a container full of items.

def habitat.sims.habitat_simulator.kinematic_relationship_manager.RelationshipGraph.remove_relation(self, parent: int, child: int) -> None

Remove any relationship between the pair of objects.

Parameters
parent The parent object_id.
child The child object_id.