Collision between two Triangle meshs collider or two convext hall colliders not detected

@hclever I found a work around for the issue I described. I can group the prims together and set no_coll_prims only to cylinder:

                
                
plane_path = "/World/Plane"
cube_path = "/World/Cube"
sphere_path = "/World/Sphere"
torus_path = "/World/Torus"


with rep.new_layer():
    with rep.trigger.on_time(interval = 1):
        traversable_plane = rep.get.prim_at_path(plane_path)

        cube = rep.get.prim_at_path(cube_path)
        sphere = rep.get.prim_at_path(sphere_path)
        torus = rep.get.prim_at_path(torus_path)

        group = rep.create.group([cube, sphere])

        with rep.utils.sequential():
            with group:
                rep.randomizer.scatter_2d(traversable_plane, no_coll_prims = [torus], check_for_collisions=True)

and it works great!!

Now the issue is, how can I group replicator items returned by rep.randomizer.instantiate?

this, for example, does not work:

plane_path = "/World/Plane"
HOSE_ON_GROUND_ASSETS_DIR = "C:/Users/dsiss/Desktop/Synthia/Omniverse/randomization_assets/water_hose/rolled_on_ground"
DOLLS_ASSETS_DIR = "C:/Users/dsiss/Desktop/Synthia/Omniverse/randomization_assets/toys/dolls"


with rep.new_layer():
    with rep.trigger.on_time(interval = 1):
        traversable_plane = rep.get.prim_at_path(plane_path)

        hoses_usd = rep.utils.get_usd_files(HOSE_ON_GROUND_ASSETS_DIR)
        dolls_usd = rep.utils.get_usd_files(DOLLS_ASSETS_DIR)
        
        hoses = rep.randomizer.instantiate(hoses_usd, size=1, use_cache = False)
        dolls = rep.randomizer.instantiate(dolls_usd, size=1, use_cache = False)

        group = rep.create.group([hoses, dolls])

        with rep.utils.sequential():
            with group:
                rep.randomizer.scatter_2d(traversable_plane, check_for_collisions=True)

The issue with rep.get.prim_at_path not working properly is due to a bug inside of a function that connects it with the scatter. Thanks for helping to find this - i reported it and we will try to get you some workaround in the interim. I don’t think it’s related to the issue with rep.randomizer.instantiate - let me explore that tomorrow.

-H

This node is the same node created using the scatter_2d method yes.
I am sure it can be triggered programmatically using the event system.

Lior Ben Horin
Partner Manager, Developer Relations - Omniverse
NVIDIA

@hclever awesome, thank you again for all of this great help. I was able to make it work with adjusting the way I use the instantiate function:

plane_path = "/World/Plane"
HOSE_ON_GROUND_ASSETS_DIR = "C:/Users/dsiss/Desktop/synthia-LFS/Omniverse/randomization_assets/water_hose/rolled_on_ground"
DOLLS_ASSETS_DIR = "C:/Users/dsiss/Desktop/synthia-LFS/Omniverse/randomization_assets/toys/dolls"

cube = rep.create.cube()

with rep.new_layer():
    with rep.trigger.on_time(interval = 1):
        traversable_plane = rep.get.prim_at_path(plane_path)

        hoses_usd = rep.utils.get_usd_files(HOSE_ON_GROUND_ASSETS_DIR)
        dolls_usd = rep.utils.get_usd_files(DOLLS_ASSETS_DIR)

        list = hoses_usd + dolls_usd

        group = rep.randomizer.instantiate(paths = list, size = 5, use_cache = False)

        with rep.utils.sequential():
            with group:
                rep.randomizer.scatter_2d(traversable_plane, no_coll_prims= [cube], check_for_collisions=True)

as far as the rep.get.prim_at_path bug, I was able to work around it with using the group function:

plane_path = "/World/Plane"
cube_path = "/World/Cube"
sphere_path = "/World/Sphere"
torus_path = "/World/Torus"


with rep.new_layer():
    with rep.trigger.on_time(interval = 1):
        traversable_plane = rep.get.prim_at_path(plane_path)

        cube = rep.get.prim_at_path(cube_path)
        sphere = rep.get.prim_at_path(sphere_path)
        torus = rep.get.prim_at_path(torus_path)

        group = rep.create.group([cube, sphere])

        with rep.utils.sequential():
            with group:
                rep.randomizer.scatter_2d(traversable_plane, no_coll_prims = [torus], check_for_collisions=True)

Thank you again for everything,
Danielle

@danielle.sisserman ive created a snippet and a demo scene for you:

Load the scene and run the code:

carter-base-motion_flat.zip (1.6 MB)

import omni
import omni.replicator.core as rep
import omni.graph.core as og
from omni.kit.viewport.utility import get_active_viewport


keys = og.Controller.Keys
graph, _, _, _ = og.Controller.edit("/World/ScatterGraph")
graph.change_pipeline_stage(og.GraphPipelineStage.GRAPH_PIPELINE_STAGE_ONDEMAND)
_, _, _, nodes = og.Controller.edit(
    "/World/ScatterGraph",
    {
        keys.CREATE_NODES: [
            ("OnPhysicsStep", "omni.isaac.core_nodes.OnPhysicsStep"),
            ("OgnScatter2D", "omni.replicator.core.OgnScatter2D"),
            ("FindPrims", "omni.graph.nodes.FindPrims")],
        keys.CONNECT: [
            ("OnPhysicsStep.outputs:step", "OgnScatter2D.inputs:execIn"),
            ("FindPrims.outputs:prims", "OgnScatter2D.inputs:prims")
        ],
        keys.SET_VALUES: [
            ("FindPrims.inputs:rootPrimPath", "/World/random_stuff"),
            ("FindPrims.inputs:type", "Mesh"),
            ("OgnScatter2D.inputs:surfacePrims", ["/World/terrain/Grid/Grid"]),
            ("OgnScatter2D.inputs:noCollPrims", ["/World/carter/chassis_link/collision_mesh"]),
            ("OgnScatter2D.inputs:checkForCollisions", True)
        ]
    },
)

viewport = get_active_viewport()
camera_path = viewport.get_active_camera()

async def run_randomization(num_frames=10):
    for _ in range(num_frames):
        await rep.orchestrator.step_async(rt_subframes=10)

    await omni.kit.app.get_app().next_update_async()
    rep.orchestrator.stop()

num_frames = 50
asyncio.ensure_future(run_randomization(num_frames))

In this code, a graph will be created programmatically, and will be executed once at every physics step.
Note that I have added a mesh into the crater chassis_link

I can see you also try to use replicator “with” statements, just remember the limitations.

@lbenhorin awesome! I will try it out! Thank you for all of your help.

@hclever do you have any idea how I can group together prims created by rep.randomizer.instantiate?

this for example does not work. The group method simply returns hoses_prims:


import omni.replicator.core as rep
import random 


plane_path = "/World/Plane"
HOSE_ON_GROUND_ASSETS_DIR = "C:/Users/dsiss/Desktop/synthia-LFS/Omniverse/randomization_assets/water_hose/rolled_on_ground"
DOLLS_ASSETS_DIR = "C:/Users/dsiss/Desktop/synthia-LFS/Omniverse/randomization_assets/toys/dolls"


with rep.new_layer():

    traversable_plane = rep.get.prim_at_path(plane_path)

    hoses_usd = rep.utils.get_usd_files(HOSE_ON_GROUND_ASSETS_DIR)
    hoses_prims = rep.randomizer.instantiate(hoses_usd, size=4, with_replacements = False, use_cache = False)
   

    dolls_usd = rep.utils.get_usd_files(DOLLS_ASSETS_DIR)
    dolls_prims = rep.randomizer.instantiate(dolls_usd, size=4, with_replacements = False, use_cache = False)
    
    group = rep.create.group(items=[hoses_prims, dolls_prims])


    with rep.utils.sequential():
        with group:
            rep.randomizer.scatter_2d(traversable_plane, check_for_collisions=True)

Would really appriciate your help with this issue.
Thank you

Hi! Which version of replicator are you using? I just tried a similar script with the latest (which is also Isaac sim 4.0.0, which was very recently released) and it seems to work fine. I used my own USD assets but should work the same?

I did not download 4.0.0 yet, that might solve it. Thank you