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.
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:
def on_overlap_callback(self, hit):
single_hit_check = False # iterate all overlaping objects
get_physx_scene_query_interface().overlap_box(extent, origin, quat, on_overlap_callback, single_hit_check)
For me and my 3D scatter box my spawned parts were still spawned in another even with check_for_collisions = True, just fyi
Thanks for letting us know, can you provide a short repro script so I can test it and if needed to forward it as a bug?
I did use the “offline_generation.py” script and just edited the “rep.randomizer.scatter_2d” function to 3d in line 87and created a cube instead of a plane beforehand with
scatter_box = rep.create.cube(
scale=0.3, position=(0,0,0.3), visible=False
I just used some YCB Props and dropped them somewhere. They did drop, but while spawning they seemed to be colliding with eachother or get tangled.
I tested with the following script and it works:
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.
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.