habitat.datasets.rearrange.samplers.object_target_sampler.ObjectTargetSampler class

Base sampler for object targets. Instead of sampling from an object template set, sample from an instance set.

Methods

def reset(self) -> None
Reset any per-scene variables.
def sample(self, sim: habitat_sim.simulator.Simulator, recep_tracker: receptacle.ReceptacleTracker, snap_down: bool = False, dbv: typing.Optional[sims.habitat_simulator.debug_visualizer.DebugVisualizer] = None, target_receptacles = None, goal_receptacles = None, object_to_containing_receptacle = None) -> typing.Optional[typing.Dict[str, typing.Tuple[habitat_sim._ext.habitat_sim_bindings.ManagedRigidObject, receptacle.Receptacle]]]
Overridden sampler maps to instances without replacement.
def sample_object(self) -> str
Sample an object handle from the object_set and return it.
def sample_placement(self, sim: habitat_sim.simulator.Simulator, object_handle: str, receptacle: receptacle.Receptacle, snap_down: bool = False, dbv: typing.Optional[sims.habitat_simulator.debug_visualizer.DebugVisualizer] = None) -> typing.Optional[habitat_sim._ext.habitat_sim_bindings.ManagedRigidObject]
Attempt to sample a valid placement of the object in/on a receptacle given an object handle and receptacle information.
def sample_receptacle(self, sim: habitat_sim.simulator.Simulator, recep_tracker: receptacle.ReceptacleTracker, cull_tilted_receptacles: bool = True, tilt_tolerance: float = 0.9) -> receptacle.Receptacle
Sample a receptacle from the receptacle_set and return relevant information.
def set_num_samples(self) -> None
Choose a target number of objects to sample from the configured range.
def single_sample(self, sim: habitat_sim.simulator.Simulator, recep_tracker: receptacle.ReceptacleTracker, snap_down: bool = False, dbv: typing.Optional[sims.habitat_simulator.debug_visualizer.DebugVisualizer] = None, fixed_target_receptacle = None, fixed_obj_handle: typing.Optional[str] = None) -> typing.Optional[habitat_sim._ext.habitat_sim_bindings.ManagedRigidObject]
Sample a single object placement by first sampling a Receptacle candidate, then an object, then attempting to place that object on the Receptacle.

Special methods

def __init__(self, object_instance_set: typing.List[habitat_sim._ext.habitat_sim_bindings.ManagedRigidObject], *args, **kwargs) -> None
Initialize a standard ObjectSampler but construct the object_set to correspond with specific object instances provided.

Method documentation

def habitat.datasets.rearrange.samplers.object_target_sampler.ObjectTargetSampler.sample(self, sim: habitat_sim.simulator.Simulator, recep_tracker: receptacle.ReceptacleTracker, snap_down: bool = False, dbv: typing.Optional[sims.habitat_simulator.debug_visualizer.DebugVisualizer] = None, target_receptacles = None, goal_receptacles = None, object_to_containing_receptacle = None) -> typing.Optional[typing.Dict[str, typing.Tuple[habitat_sim._ext.habitat_sim_bindings.ManagedRigidObject, receptacle.Receptacle]]]

Overridden sampler maps to instances without replacement.

Parameters
sim The Simulator instance.
recep_tracker The ReceptacleTracker containing ReceptacleSet and use information.
snap_down Whether or not to use the snapdown utility for placement.
dbv An optional DebugVisualizer (dbv) to gather placement debug images.
target_receptacles Specify precise Receptacles to use instead of sampling.
goal_receptacles Provide the list of Receptacles pre-selected for goal placement.
object_to_containing_receptacle Dictionary mapping object handles to receptacles containing them.

def habitat.datasets.rearrange.samplers.object_target_sampler.ObjectTargetSampler.sample_placement(self, sim: habitat_sim.simulator.Simulator, object_handle: str, receptacle: receptacle.Receptacle, snap_down: bool = False, dbv: typing.Optional[sims.habitat_simulator.debug_visualizer.DebugVisualizer] = None) -> typing.Optional[habitat_sim._ext.habitat_sim_bindings.ManagedRigidObject]

Attempt to sample a valid placement of the object in/on a receptacle given an object handle and receptacle information.

Parameters
sim The active Simulator instance.
object_handle The handle of the object template for instantiation and attempted placement.
receptacle The Receptacle instance on which to sample a placement position.
snap_down Whether or not to use the snap_down utility to place the object.
dbv Optionally provide a DebugVisualizer(dbv)

def habitat.datasets.rearrange.samplers.object_target_sampler.ObjectTargetSampler.sample_receptacle(self, sim: habitat_sim.simulator.Simulator, recep_tracker: receptacle.ReceptacleTracker, cull_tilted_receptacles: bool = True, tilt_tolerance: float = 0.9) -> receptacle.Receptacle

Sample a receptacle from the receptacle_set and return relevant information.

Parameters
sim The active Simulator instance.
recep_tracker The pre-initialized ReceptacleTracker object defining available ReceptacleSets.
cull_tilted_receptacles Whether or not to remove tilted Receptacles from the candidate set.
tilt_tolerance If cull_tilted_receptacles is True, receptacles are culled for objects with local “down” (-Y), not aligned with gravity (unit dot product compared to tilt_tolerance).

def habitat.datasets.rearrange.samplers.object_target_sampler.ObjectTargetSampler.single_sample(self, sim: habitat_sim.simulator.Simulator, recep_tracker: receptacle.ReceptacleTracker, snap_down: bool = False, dbv: typing.Optional[sims.habitat_simulator.debug_visualizer.DebugVisualizer] = None, fixed_target_receptacle = None, fixed_obj_handle: typing.Optional[str] = None) -> typing.Optional[habitat_sim._ext.habitat_sim_bindings.ManagedRigidObject]

Sample a single object placement by first sampling a Receptacle candidate, then an object, then attempting to place that object on the Receptacle.

Parameters
sim The active Simulator instance.
recep_tracker The pre-initialized ReceptacleTracker instace containg active ReceptacleSets.
snap_down Whether or not to use the snap_down utility to place the objects.
dbv Optionally provide a DebugVisualizer (dbv)
fixed_target_receptacle Optionally provide a pre-selected Receptacle instead of sampling. For example, when a target object’s receptacle is selected in advance.
fixed_obj_handle Optionally provide a pre-selected object instead of sampling. For example, when sampling the goal position for a known target object.