class
KinematicRelationshipManagerManages the kinematic relationships between objects such that object states can be manipulated while maintaining said relationships.
Methods
- def _apply_relations_recursive(self, parent_id: int, snapshot: typing.Dict[int, typing.Dict[int, _magnum.Matrix4]], applied_to: typing.Dict[int, bool]) -> None
- Apply the snapshot transform relations recursively to the subtree with parent_id as root.
- def _get_relations_recursive(self, parent_id: int, wip_snapshot: typing.Dict[int, typing.Dict[int, _magnum.Matrix4]]) -> None
- Gather the relative transforms for the “work in progress” snapshot relations recursively to all children of the parent_id.
- def apply_relations(self) -> typing.List[int]
- Apply the previous relationship snapshot. Call this in the kinematic sim loop when objects are updated.
- def apply_relationships_snapshot(self, snapshot: typing.Dict[int, typing.Dict[int, _magnum.Matrix4]], apply_all: bool = True) -> typing.List[int]
- Apply all transformations cached in the provided snapshot.
- def get_relations_snapshot(self, root_parent_subset: typing.Optional[typing.List[int]] = None) -> typing.Dict[int, typing.Dict[int, _magnum.Matrix4]]
- Get the current parent to child transforms for all registered relationships.
- def get_root_parents_snapshot(self, root_parent_subset: typing.Optional[typing.List[int]] = None) -> typing.Dict[int, _magnum.Matrix4]
- Get the global transformations for all root parents: those without any parent.
- def initialize_from_dynamic_ontop(self) -> None
- Scrape current scene contents to initialize the relationship graph via the “ontop” util, requiring that objects are dynamically simulated such that contact can be used as a heuristic for support relationships.
- def initialize_from_obj_to_rec_pairs(self, obj_to_rec: typing.Dict[str, str], receptacles: typing.List[datasets.rearrange.samplers.receptacle.Receptacle]) -> None
- Initialize the RelationshipGraph from object to receptacle mappings as found in a RearrangeEpisode.
- def update_snapshots(self, root_parent_subset: typing.Optional[typing.List[int]] = None) -> None
- Update the internal previous snapshots.
Special methods
- def __init__(self, sim: habitat_sim.simulator.Simulator) -> None
Method documentation
def habitat. sims. habitat_simulator. kinematic_relationship_manager. KinematicRelationshipManager. _apply_relations_recursive(self,
parent_id: int,
snapshot: typing.Dict[int, typing.Dict[int, _magnum.Matrix4]],
applied_to: typing.Dict[int, bool]) -> None
Apply the snapshot transform relations recursively to the subtree with parent_id as root.
Parameters | |
---|---|
parent_id | The parent of the subtree on which to recurse. |
snapshot | The snapshot being consumed by this recursive process. Contains both parent->child mapping and transforms. |
applied_to | Tracks wether an object has already had a transform applied previously. Prevents infinite recursion in edge cases with cyclic relationships. |
def habitat. sims. habitat_simulator. kinematic_relationship_manager. KinematicRelationshipManager. _get_relations_recursive(self,
parent_id: int,
wip_snapshot: typing.Dict[int, typing.Dict[int, _magnum.Matrix4]]) -> None
Gather the relative transforms for the “work in progress” snapshot relations recursively to all children of the parent_id.
Parameters | |
---|---|
parent_id | The parent of the subtree on which to recurse. |
wip_snapshot | The work-in-progress snapshot being constructed by this recursive process. default_dict(lambda: {}) |
def habitat. sims. habitat_simulator. kinematic_relationship_manager. KinematicRelationshipManager. apply_relations(self) -> typing.List[int]
Apply the previous relationship snapshot. Call this in the kinematic sim loop when objects are updated.
Returns | The list of root parents for which the subtree transforms were updated. |
---|
def habitat. sims. habitat_simulator. kinematic_relationship_manager. KinematicRelationshipManager. apply_relationships_snapshot(self,
snapshot: typing.Dict[int, typing.Dict[int, _magnum.Matrix4]],
apply_all: bool = True) -> typing.List[int]
Apply all transformations cached in the provided snapshot.
Parameters | |
---|---|
snapshot | The snapshot with parent to child transformations which should be applied. |
apply_all | If set, apply all transforms without checking for root parent transform deltas. Use False to limit application to dirty transforms. |
Returns | The list of root parents for which the subtree transforms were updated. |
def habitat. sims. habitat_simulator. kinematic_relationship_manager. KinematicRelationshipManager. get_relations_snapshot(self,
root_parent_subset: typing.Optional[typing.List[int]] = None) -> typing.Dict[int, typing.Dict[int, _magnum.Matrix4]]
Get the current parent to child transforms for all registered relationships.
Parameters | |
---|---|
root_parent_subset | Optionally, only compute the relations snapshot for a subset of root parents. Default is all root parents. |
Returns | A dictionary mapping parent object_id to dictionaries mapping each child object_id to the relative transformation matrix between parent and child. |
NOTE: Some objects may have multiple parents.
def habitat. sims. habitat_simulator. kinematic_relationship_manager. KinematicRelationshipManager. get_root_parents_snapshot(self,
root_parent_subset: typing.Optional[typing.List[int]] = None) -> typing.Dict[int, _magnum.Matrix4]
Get the global transformations for all root parents: those without any parent.
Parameters | |
---|---|
root_parent_subset | Optionally, only compute the snapshot for a subset of root parents. Default is all root parents. |
Returns | dictionary mapping root parent object_ids to their global transformation matrices. |
def habitat. sims. habitat_simulator. kinematic_relationship_manager. KinematicRelationshipManager. initialize_from_obj_to_rec_pairs(self,
obj_to_rec: typing.Dict[str, str],
receptacles: typing.List[datasets.rearrange.samplers.receptacle.Receptacle]) -> None
Initialize the RelationshipGraph from object to receptacle mappings as found in a RearrangeEpisode.
Parameters | |
---|---|
obj_to_rec | Map from object instance names to Receptacle unique names. |
receptacles | A list of active Receptacle objects. |
def habitat. sims. habitat_simulator. kinematic_relationship_manager. KinematicRelationshipManager. update_snapshots(self,
root_parent_subset: typing.Optional[typing.List[int]] = None) -> None
Update the internal previous snapshots.
Parameters | |
---|---|
root_parent_subset | If provided, limit the updates to particular root parents. This is an efficiency option to avoid wasting time in sparse delta situations. For example, when an update is needed after a single state change such as opening or closing a link. |
def habitat. sims. habitat_simulator. kinematic_relationship_manager. KinematicRelationshipManager. __init__(self,
sim: habitat_sim.simulator.Simulator) -> None
Parameters | |
---|---|
sim | The Simulator instance to which this KinematicRelationshipManager is attached. |