blenderproc.python.object.ObjectPoseSampler module

Allows the sampling of objects inside a sampling volume, while performing collision checks.

blenderproc.python.object.ObjectPoseSampler.sample_poses(objects_to_sample, sample_pose_func, objects_to_check_collisions=None, max_tries=1000, mode_on_failure='last_pose')[source]

Samples positions and rotations of selected object inside the sampling volume while performing mesh and bounding box collision checks.

Parameters:
  • objects_to_sample (List[MeshObject]) – A list of mesh objects whose poses are sampled based on the given function.

  • sample_pose_func (Callable[[MeshObject], None]) – The function to use for sampling the pose of a given object.

  • objects_to_check_collisions (Optional[List[MeshObject]]) – A list of mesh objects who should not be considered when checking for collisions.

  • max_tries (int) – Amount of tries before giving up on an object and moving to the next one.

  • mode_on_failure (str) – Define final state of objects that could not be placed without collisions within max_tries attempts. Options: ‘last_pose’, ‘initial_pose’

Return type:

Dict[Entity, Tuple[int, bool]]

Returns:

A dict with the objects to sample as keys and a Tuple with the number of executed attempts to place the object as first element, and a bool whether it has been successfully placed without collisions.