Isaac-Sim OIGE - Collision Filters Error

The code for OIGE and the robot usd can be found at the end.

The Spot Robot clips through the ground plane, the collision filters seem to be making the robots filter the ground plane collision.

When I manually stoped the simulation and added an ground plane they seemed to collide. But that wouldnt work with the Terrain environment.
The terrain that is programatically added has a collision mesh that is being filtered by all robots in the “env”

I added a Spot robot, files can be found in

  • Tasks - spot.py & spot_terrain.py
  • robots - spot.py and spot_view.py
  • cfg task - Spot.yaml & SpotTerrain.yaml
  • cfg train - SpotPPO.yaml & SpotTerrainPPO.yaml

SpotTerrain_stage


You can find my code on the dev tree:

Robot USD

Hi there, thanks for reporting the issue. The terrain prim path should be added to the collision_filter_global_paths list to enable collision. We can expose this variable to the task class so that it can be set directly from the task.

I imagine the problem might be that Spot has a much more complex collision mesh.
image

Below we can see that the code is adding the colliders properly. But for some reason it is not handling the more complex collision mesh of Spot. I fail to understand why.

Here are the Colliders for Anymal


Here are the Colliders for Spot


It is interesting that the terrain util creates a mesh with an outdate collider that kit seems to ignore. Maybe this issue is deeper.
I can create terrains with kit commands and they work fine. Just the terrains created with OIGE code that doesnt collide with the robots I import.
Duct tape solution is to use omni.kit.commands :

            stage = omni.usd.get_context().get_stage()
            omni.kit.commands.execute(
                "AddGroundPlaneCommand",
                stage=stage,
                planePath="/groundPlane",
                axis="Z",
                size=1500.0,
                position=Gf.Vec3f(0, 0, -50),
                color=Gf.Vec3f(0.5),
            )```

Inside of utils/terrain_utils/terrain_utils.py
I found at line 367 the add_terrain_to_stage method.
I played by addind different types of colliders with some success, my guess is that something changed on physx and it no longer works as supposed to. Need to figure out now how to wrap a high detailed collision mesh and it should work.

def add_terrain_to_stage(stage, vertices, triangles, position=None, orientation=None):
    num_faces = triangles.shape[0]
    terrain_mesh = stage.DefinePrim("/World/terrain", "Mesh")
    terrain_mesh.GetAttribute("points").Set(vertices)
    terrain_mesh.GetAttribute("faceVertexIndices").Set(triangles.flatten())
    terrain_mesh.GetAttribute("faceVertexCounts").Set(np.asarray([3]*num_faces))

    terrain = XFormPrim(prim_path="/World/terrain",
                        name="terrain",
                        position=position,
                        orientation=orientation)
    # Addind a simple Collider does not work
    # omni.kit.commands.execute('SetStaticCollider',
    #     path=Sdf.Path('/World/terrain'),
    #     approximationShape='none')


    UsdPhysics.CollisionAPI.Apply(terrain.prim)
    collision_api = UsdPhysics.MeshCollisionAPI.Apply(terrain.prim)
    collision_api.CreateApproximationAttr().Set("meshSimplification")
    physx_collision_api = PhysxSchema.PhysxCollisionAPI.Apply(terrain.prim)
    physx_collision_api.GetContactOffsetAttr().Set(0.02)
    physx_collision_api.GetRestOffsetAttr().Set(0.00)