habitat.datasets.rearrange.samplers.receptacle module

Classes

class AABBReceptacle
Defines an AABB Receptacle volume above a surface for sampling object placements within a scene.
class AnyObjectReceptacle
The AnyObjectReceptacle enables any rigid or articulated object or link to be used as a Receptacle without metadata annotation. It uses the top surface of an object’s global space bounding box as a heuristic for the sampling area. The sample efficiency is likely to be poor (especially for concave objects like L-shaped sofas), TODO: this could be mitigated by the option to pre-compute a discrete set of candidate points via raycast upon initialization. Also, this heuristic will not support use of interior surfaces such as cubby and cabinet shelves since volumetric occupancy is not considered.
class OnTopOfReceptacle
class Receptacle
class ReceptacleSet
ReceptacleSet(name: str, included_object_substrings: List[str], excluded_object_substrings: List[str], included_receptacle_substrings: List[str], excluded_receptacle_substrings: List[str], is_on_top_of_sampler: bool = False, comment: str = ”)
class ReceptacleTracker
class TriangleMeshReceptacle
Defines a Receptacle surface as a triangle mesh. TODO: configurable maximum height.

Functions

def assert_triangles(indices: typing.List[int]) -> None
Assert that an index array is divisible by 3 as a heuristic for triangle-only faces.
def cull_filtered_receptacles(receptacles: typing.List[Receptacle], exclude_filter_strings: typing.List[str]) -> typing.List[Receptacle]
Filter a list of Receptacles to exclude any which are matched to the provided exclude_filter_strings. Each string in filter strings is checked against each receptacle’s unique_name. If the unique_name contains any filter string as a substring, that Receptacle is filtered.
def filter_interleave_mesh(mesh: _magnum.trade.MeshData) -> _magnum.trade.MeshData
Filter all but position data and interleave a mesh to reduce overall memory footprint. Convert triangle like primitives into triangles and assert only triangles remain.
def find_receptacles(sim: habitat_sim.simulator.Simulator, ignore_handles: typing.Optional[typing.List[str]] = None, exclude_filter_strings: typing.Optional[typing.List[str]] = None) -> typing.List[typing.Union[Receptacle, AABBReceptacle, TriangleMeshReceptacle]]
Scrape and return a list of all Receptacles defined in the metadata belonging to the scene’s currently instanced objects.
def get_all_scenedataset_receptacles(sim: habitat_sim.simulator.Simulator) -> typing.Dict[str, typing.Dict[str, typing.List[str]]]
Scrapes the active SceneDataset from a Simulator for all receptacle names defined in rigid/articulated object and stage templates for investigation and preview purposes. Note this will not include scene-specific overrides defined in scene_config.json files. Only receptacles defined in object_config.json, ao_config.json, and stage_config.json files or added programmatically to associated Attributes objects will be found.
def get_excluded_recs_from_filter_file(rec_filter_filepath: str, filter_types: typing.Optional[typing.List[str]] = None) -> typing.List[str]
Load and digest a Receptacle filter file to generate a list of Receptacle.unique_names strings which should be excluded from the active ReceptacleSet.
def get_navigable_receptacles(sim: habitat_sim.simulator.Simulator, receptacles: typing.List[Receptacle], nav_island: int, nav_to_min_distance: float = 1.5) -> typing.List[Receptacle]
Given a list of receptacles, return the ones that are heuristically navigable from the largest indoor navmesh island.
def get_obj_manager_for_receptacle(sim: habitat_sim.simulator.Simulator, receptacle: Receptacle) -> typing.Union[habitat_sim._ext.habitat_sim_bindings.RigidObjectManager, habitat_sim._ext.habitat_sim_bindings.ArticulatedObjectManager]
Get the correct object manager for the Receptacle.
def get_recs_from_filter_file(rec_filter_filepath: str, filter_types: typing.List[str]) -> typing.List[str]
Load and digest a Receptacle filter file to generate a list of Receptacle.unique_names which belong to a particular filter subset.
def get_scene_rec_filter_filepath(mm: habitat_sim._ext.habitat_sim_bindings.MetadataMediator, scene_handle: str) -> str
Look in the user_defined metadata for a scene to find the configured filepath for the scene’s Receptacle filter file.
def import_tri_mesh(mesh_file: str) -> typing.List[_magnum.trade.MeshData]
Returns a list of MeshData objects from a mesh asset using magnum trade importer.
def parse_receptacles_from_user_config(user_subconfig: habitat_sim._ext.habitat_sim_bindings.Configuration, parent_object_handle: typing.Optional[str] = None, parent_template_directory: str = '', valid_link_names: typing.Optional[typing.List[str]] = None, ao_uniform_scaling: float = 1.0) -> typing.List[typing.Union[Receptacle, AABBReceptacle, TriangleMeshReceptacle]]
Parse receptacle metadata from the provided user subconfig object.

Function documentation

def habitat.datasets.rearrange.samplers.receptacle.cull_filtered_receptacles(receptacles: typing.List[Receptacle], exclude_filter_strings: typing.List[str]) -> typing.List[Receptacle]

Filter a list of Receptacles to exclude any which are matched to the provided exclude_filter_strings. Each string in filter strings is checked against each receptacle’s unique_name. If the unique_name contains any filter string as a substring, that Receptacle is filtered.

Parameters
receptacles The initial list of Receptacle objects.
exclude_filter_strings The list of filter substrings defining receptacles which should not be active in the current scene.

def habitat.datasets.rearrange.samplers.receptacle.filter_interleave_mesh(mesh: _magnum.trade.MeshData) -> _magnum.trade.MeshData

Filter all but position data and interleave a mesh to reduce overall memory footprint. Convert triangle like primitives into triangles and assert only triangles remain.

Returns The modified mesh for easy of use.

def habitat.datasets.rearrange.samplers.receptacle.find_receptacles(sim: habitat_sim.simulator.Simulator, ignore_handles: typing.Optional[typing.List[str]] = None, exclude_filter_strings: typing.Optional[typing.List[str]] = None) -> typing.List[typing.Union[Receptacle, AABBReceptacle, TriangleMeshReceptacle]]

Scrape and return a list of all Receptacles defined in the metadata belonging to the scene’s currently instanced objects.

Parameters
sim Simulator must be provided.
ignore_handles An optional list of handles for ManagedObjects which should be skipped. No Receptacles for matching objects will be returned.
exclude_filter_strings An optional list of excluded Receptacle substrings. Any Receptacle which contains any excluded filter substring in its unique_name will not be included in the returned set.

def habitat.datasets.rearrange.samplers.receptacle.get_all_scenedataset_receptacles(sim: habitat_sim.simulator.Simulator) -> typing.Dict[str, typing.Dict[str, typing.List[str]]]

Scrapes the active SceneDataset from a Simulator for all receptacle names defined in rigid/articulated object and stage templates for investigation and preview purposes. Note this will not include scene-specific overrides defined in scene_config.json files. Only receptacles defined in object_config.json, ao_config.json, and stage_config.json files or added programmatically to associated Attributes objects will be found.

Returns a dict with keys {“stage”, “rigid”, “articulated”} mapping object template handles to lists of receptacle names.

param sim:
Simulator must be provided.

def habitat.datasets.rearrange.samplers.receptacle.get_excluded_recs_from_filter_file(rec_filter_filepath: str, filter_types: typing.Optional[typing.List[str]] = None) -> typing.List[str]

Load and digest a Receptacle filter file to generate a list of Receptacle.unique_names strings which should be excluded from the active ReceptacleSet.

Parameters
rec_filter_filepath
filter_types Optionally specify a particular set of filter types to scrape. Default is all exclusion filters.

def habitat.datasets.rearrange.samplers.receptacle.get_navigable_receptacles(sim: habitat_sim.simulator.Simulator, receptacles: typing.List[Receptacle], nav_island: int, nav_to_min_distance: float = 1.5) -> typing.List[Receptacle]

Given a list of receptacles, return the ones that are heuristically navigable from the largest indoor navmesh island.

Navigability heuristic is that at least two Receptacle AABB corners are within 1.5m of the largest indoor navmesh island and object is within 0.2m of the configured agent height.

param sim:
The Simulator instance.
param receptacles:
The list of Receptacle instances to cull.
param nav_island:
The NavMesh island on which to check accessibility. -1 is the full NavMesh.
param nav_to_min_distance:
Minimum distance threshold. -1 opts out of the test and returns True (i.e. no minimum distance).
return:
The list of heuristic passing Receptacle instances.

def habitat.datasets.rearrange.samplers.receptacle.get_obj_manager_for_receptacle(sim: habitat_sim.simulator.Simulator, receptacle: Receptacle) -> typing.Union[habitat_sim._ext.habitat_sim_bindings.RigidObjectManager, habitat_sim._ext.habitat_sim_bindings.ArticulatedObjectManager]

Get the correct object manager for the Receptacle.

Parameters
sim The Simulator instance.
receptacle The Receptacle instance.

def habitat.datasets.rearrange.samplers.receptacle.get_recs_from_filter_file(rec_filter_filepath: str, filter_types: typing.List[str]) -> typing.List[str]

Load and digest a Receptacle filter file to generate a list of Receptacle.unique_names which belong to a particular filter subset.

Parameters
rec_filter_filepath
filter_types Specify a particular subset of filter types to include.

def habitat.datasets.rearrange.samplers.receptacle.get_scene_rec_filter_filepath(mm: habitat_sim._ext.habitat_sim_bindings.MetadataMediator, scene_handle: str) -> str

Look in the user_defined metadata for a scene to find the configured filepath for the scene’s Receptacle filter file.

Returns Filter filepath or None if not found.

def habitat.datasets.rearrange.samplers.receptacle.import_tri_mesh(mesh_file: str) -> typing.List[_magnum.trade.MeshData]

Returns a list of MeshData objects from a mesh asset using magnum trade importer.

Parameters
mesh_file The input meshes file. NOTE: must contain only triangles.

def habitat.datasets.rearrange.samplers.receptacle.parse_receptacles_from_user_config(user_subconfig: habitat_sim._ext.habitat_sim_bindings.Configuration, parent_object_handle: typing.Optional[str] = None, parent_template_directory: str = '', valid_link_names: typing.Optional[typing.List[str]] = None, ao_uniform_scaling: float = 1.0) -> typing.List[typing.Union[Receptacle, AABBReceptacle, TriangleMeshReceptacle]]

Parse receptacle metadata from the provided user subconfig object.

Parameters
user_subconfig The Configuration object containing metadata parsed from the “user_defined” JSON field for rigid/articulated object and stage configs.
parent_object_handle The instance handle of the rigid or articulated object to which constructed Receptacles are attached. None or globally defined stage Receptacles.
parent_template_directory The filesystem directory path containing the configuration file. Used to construct the absolute asset path from the relative asset path.
valid_link_names An indexed list of link names for validating configured Receptacle attachments. Provided only for ArticulatedObjects.
ao_uniform_scaling Uniform scaling applied to the parent AO is applied directly to the Receptacle.

Construct and return a list of Receptacle objects. Multiple Receptacles can be defined in a single user subconfig.