class
ObjectSamplerSample an object from a set and try to place it in the scene on a Receptacles from some Receptacle set.
Methods
- def reset(self) -> None
- Reset any per-scene variables.
- def sample(self, sim: habitat_sim.simulator.Simulator, recep_tracker: receptacle.ReceptacleTracker, target_receptacles: typing.List[receptacle.Receptacle], snap_down: bool = False, dbv: typing.Optional[sims.habitat_simulator.debug_visualizer.DebugVisualizer] = None, target_object_handles: typing.Optional[typing.List[str]] = None, object_idx_to_recep: typing.Optional[typing.Dict[int, receptacle.Receptacle]] = None) -> typing.List[typing.Tuple[habitat_sim._ext.habitat_sim_bindings.ManagedRigidObject, receptacle.Receptacle]]
- Defaults to uniform sample: object -> receptacle -> volume w/ rejection -> repeat.
- 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_set: typing.List[str], allowed_recep_set_names: typing.List[str], num_objects: typing.Tuple[int, int] = (1, 1), orientation_sample: typing.Optional[str] = None, sample_region_ratio: typing.Optional[typing.Dict[str, float]] = None, nav_to_min_distance: float = -1.0, recep_set_sample_probs: typing.Optional[typing.Dict[str, float]] = None, translation_up_offset: float = 0.08, constrain_to_largest_nav_island: bool = False) -> None
Method documentation
def habitat. datasets. rearrange. samplers. object_sampler. ObjectSampler. sample(self,
sim: habitat_sim.simulator.Simulator,
recep_tracker: receptacle.ReceptacleTracker,
target_receptacles: typing.List[receptacle.Receptacle],
snap_down: bool = False,
dbv: typing.Optional[sims.habitat_simulator.debug_visualizer.DebugVisualizer] = None,
target_object_handles: typing.Optional[typing.List[str]] = None,
object_idx_to_recep: typing.Optional[typing.Dict[int, receptacle.Receptacle]] = None) -> typing.List[typing.Tuple[habitat_sim._ext.habitat_sim_bindings.ManagedRigidObject, receptacle.Receptacle]]
Defaults to uniform sample: object -> receptacle -> volume w/ rejection -> repeat.
Parameters | |
---|---|
sim | The active Simulator instance. |
recep_tracker | The pre-initialized ReceptacleTracker instace containg active ReceptacleSets. |
target_receptacles | A list of pre-selected Receptacles for target object placement. These will be sampled first. |
snap_down | Whether or not to use the snap_down utility to place the objects. |
dbv | Optionally provide a DebugVisualizer (dbv) |
target_object_handles | |
object_idx_to_recep |
def habitat. datasets. rearrange. samplers. object_sampler. ObjectSampler. 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_sampler. ObjectSampler. 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_sampler. ObjectSampler. 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. |