I am using scatter_2d however my objects of interests (here pallets) that are thrown are not collision free and here they collide with the boxes in offline_generation.py. This happens despite using check_for_collisions=True so I am not sure what I should use so objects don’t be spawn like this
Randomize boxes materials and their location on the surface of the given prim
# Calculate the bounds of the prim to create a scatter plane of its size
bb_cache = create_bbox_cache()
bbox3d_gf = bb_cache.ComputeLocalBound(prim)
prim_tf_gf = omni.usd.get_world_transform_matrix(prim)
# Calculate the bounds of the prim
range_size = bbox3d_gf.GetRange().GetSize()
# Get the quaterion of the prim in xyzw format from usd
prim_quat_gf = prim_tf_gf.ExtractRotation().GetQuaternion()
prim_quat_xyzw = (prim_quat_gf.GetReal(), *prim_quat_gf.GetImaginary())
# Create a plane on the pallet to scatter the boxes on
plane_scale = (range_size * 5, range_size * 5, 1)
plane_pos_gf = prim_tf_gf.ExtractTranslation() + Gf.Vec3d(0, 0, range_size)
plane_rot_euler_deg = quat_to_euler_angles(np.array(prim_quat_xyzw), degrees=True)
scatter_plane = rep.create.plane(
scale=plane_scale, position=plane_pos_gf, rotation=plane_rot_euler_deg, visible=False
pallets2 = rep.create.from_usd(
prefix_with_isaac_asset_server(PALLET_2_URL), semantics=[("class", "Pallet2")], count=20
Here are some of the unrealistic collisions that has happened that I expect it not to happen. Thanks for any direction.
Currently check_for_collisions=True only considers the scattered objects and not their surroundings.
For such cases, I would recommend using Isaac Sim’s API to spawn/move objects and check for their collisions/overlaps with their surroundings as well.
Example of physx api call for checking for overlaps:
import omni.replicator.core as rep
print("No collision check")
spheres = rep.create.sphere(count=200)
volume_torus = rep.create.torus(scale=10, visible=True)
print("Check for collisions")
spheres_2 = rep.create.sphere(count=200)
volume_torus_2 = rep.create.torus(position=(10,10,10), scale=10, visible=True)
Can you check if you got the following error during scatter, you might be giving too many items to randomize in the volume and the algorithm times out:
[Error] [omni.graph.core.plugin] /Replicator/SDGPipeline/OgnScatter3D_02: Assertion raised in compute - Randomization timed out, cannot find a configuration to randomize prim locations and prevent collisions.