Skip to content

[Bug Report] PhysX multi-mesh ray casters place the links of a tracked robot at other environments' link poses #8677

Closed

Description

@NeoZng

Describe the bug

On PhysX, a tracked MultiMeshRayCaster or MultiMeshRayCasterCamera target that resolves to several bodies per
environment, such as the links of a robot, has most of its meshes placed at the poses of other environments'
bodies. Rays then miss the robot links of their own environment and can hit nothing, or another environment's link.

  • With a clone plan, each tracked body gets its own expression, one per owning link
    (source/isaaclab/isaaclab/sensors/ray_caster/base_multi_mesh_ray_caster.py:277).
  • PhysX reads them through one rigid-body view over that list of patterns
    (source/isaaclab_physx/isaaclab_physx/sensors/ray_caster/ray_caster.py:136). Such a view lists the bodies one
    pattern after another, as the PhysX contact sensor notes: "view_id = body_id * num_envs + env_id"
    (source/isaaclab_physx/isaaclab_physx/sensors/contact_sensor/contact_sensor.py:391-392).
  • The copy into the per-environment mesh table reads that view environment by environment:
    src_index = env * meshes_per_env + local_mesh (source/isaaclab/isaaclab/sensors/ray_caster/kernels.py:357-361,
    launched at ray_caster.py:155-170).

For three environments and a target {ENV_REGEX_NS}/Chain/link_[^/]* that matches link_a and link_b, the view
rows are [env0/link_a, env1/link_a, env2/link_a, env0/link_b, env1/link_b, env2/link_b], and the table slots
(link_a, link_b) hold:

env link_a slot link_b slot
0 env 0 link_a env 1 link_a
1 env 2 link_a env 0 link_b
2 env 1 link_b env 2 link_b

Single-body targets, the scenes without a clone plan (explicit paths in environment order) and the other backends
are not affected: OVPhysX rejects multi-pattern targets
(source/isaaclab_ov/isaaclab_ov/sensors/ray_caster/ray_caster.py:196-201), and Newton resolves its sites
environment by environment (source/isaaclab_newton/isaaclab_newton/sensors/ray_caster/newton_raycast_sensor.py:218-231).

This is the documented use of tracked targets: the MultiMeshRayCaster example tracks
{ENV_REGEX_NS}/Robot/LF_[^/]*/visuals, three links of ANYmal (base_multi_mesh_ray_caster.py:79-90), and the
Kuka-Allegro lift camera presets raycaster_depth64/128/256 track {ENV_REGEX_NS}/Robot/[^/]*/visuals, the eight
arm links, for both the base and the wrist camera
(source/isaaclab_tasks/isaaclab_tasks/core/lift/config/kuka_allegro/camera_cfg.py:63-80, :148-150, :196-198).

Steps to reproduce

"""PhysX multi-mesh ray casters place the links of a tracked articulation at other environments' link poses.

python repro_ray_caster_multi_body_targets.py --physics isaacsim_physx --device cuda:0
"""

import argparse
import os
import tempfile

from isaaclab.app import add_launcher_args, launch_simulation
from isaaclab.physics import PhysicsCfg

parser = argparse.ArgumentParser()
parser.add_argument("--physics", default="isaacsim_physx")
add_launcher_args(parser)
args_cli = parser.parse_args()

# a chain of three 0.1 m cubes at x = 0, 0.5 and 1.0 m, joined by revolute joints
CHAIN_USDA = """#usda 1.0
(
    defaultPrim = "Chain"
    metersPerUnit = 1
    upAxis = "Z"
)

def Xform "Chain" (prepend apiSchemas = ["PhysicsArticulationRootAPI"])
{
    def Xform "base" (prepend apiSchemas = ["PhysicsRigidBodyAPI"])
    {
        def Cube "box" (prepend apiSchemas = ["PhysicsCollisionAPI"])
        {
            double size = 0.1
        }
    }
    def Xform "link_a" (prepend apiSchemas = ["PhysicsRigidBodyAPI"])
    {
        double3 xformOp:translate = (0.5, 0, 0)
        uniform token[] xformOpOrder = ["xformOp:translate"]
        def Cube "box" (prepend apiSchemas = ["PhysicsCollisionAPI"])
        {
            double size = 0.1
        }
    }
    def Xform "link_b" (prepend apiSchemas = ["PhysicsRigidBodyAPI"])
    {
        double3 xformOp:translate = (1.0, 0, 0)
        uniform token[] xformOpOrder = ["xformOp:translate"]
        def Cube "box" (prepend apiSchemas = ["PhysicsCollisionAPI"])
        {
            double size = 0.1
        }
    }
    def PhysicsRevoluteJoint "joint_a"
    {
        uniform token physics:axis = "Y"
        rel physics:body0 = </Chain/base>
        rel physics:body1 = </Chain/link_a>
        point3f physics:localPos0 = (0.25, 0, 0)
        point3f physics:localPos1 = (-0.25, 0, 0)
    }
    def PhysicsRevoluteJoint "joint_b"
    {
        uniform token physics:axis = "Y"
        rel physics:body0 = </Chain/link_a>
        rel physics:body1 = </Chain/link_b>
        point3f physics:localPos0 = (0.25, 0, 0)
        point3f physics:localPos1 = (-0.25, 0, 0)
    }
}
"""


def main():
    with launch_simulation(PhysicsCfg(), args_cli) as physics_cfg:
        import isaaclab.sim as sim_utils
        from isaaclab.actuators import ImplicitActuatorCfg
        from isaaclab.assets import ArticulationCfg
        from isaaclab.scene import InteractiveScene, InteractiveSceneCfg
        from isaaclab.sensors import MultiMeshRayCasterCfg, patterns
        from isaaclab.terrains import TerrainImporterCfg
        from isaaclab.utils import configclass

        chain_path = os.path.join(tempfile.mkdtemp(), "chain.usda")
        with open(chain_path, "w") as f:
            f.write(CHAIN_USDA)

        @configclass
        class SceneCfg(InteractiveSceneCfg):
            terrain = TerrainImporterCfg(prim_path="/World/ground", terrain_type="plane")
            chain = ArticulationCfg(
                prim_path="{ENV_REGEX_NS}/Chain",
                spawn=sim_utils.UsdFileCfg(usd_path=chain_path),
                init_state=ArticulationCfg.InitialStateCfg(pos=(0.0, 0.0, 1.0)),
                actuators={"joints": ImplicitActuatorCfg(joint_names_expr=[".*"], stiffness=1.0e4, damping=1.0e2)},
            )
            # one ray straight down onto each of link_a and link_b, from 1 m above the chain
            scanner = MultiMeshRayCasterCfg(
                prim_path="{ENV_REGEX_NS}/Chain/base",
                offset=MultiMeshRayCasterCfg.OffsetCfg(pos=(0.75, 0.0, 1.0)),
                mesh_prim_paths=[MultiMeshRayCasterCfg.RaycastTargetCfg(prim_expr="{ENV_REGEX_NS}/Chain/link_[^/]*")],
                pattern_cfg=patterns.GridPatternCfg(resolution=0.5, size=(0.5, 0.0)),
                ray_alignment="world",
            )

        # no gravity, so the floating chain stays in place
        sim_cfg = sim_utils.SimulationCfg(device=args_cli.device, gravity=(0.0, 0.0, 0.0), physics=physics_cfg)
        sim = sim_utils.SimulationContext(sim_cfg)
        scene = InteractiveScene(SceneCfg(num_envs=3, env_spacing=3.0))
        sim.reset()
        sim.step()
        scene.update(sim.get_physics_dt())

        chain, scanner = scene["chain"], scene["scanner"]
        links = chain.find_bodies(["link_a", "link_b"], preserve_order=True)[0]
        link_pos = chain.data.body_link_pos_w.torch[:, links]
        hits = scanner.data.ray_hits_w.torch

        def xyz(values):
            return [[round(v, 3) for v in row] for row in values.tolist()]

        for env in range(scene.num_envs):
            print(f"env {env}: link_a, link_b at {xyz(link_pos[env])}", flush=True)
            print(f"       rays hit {xyz(hits[env])}", flush=True)


if __name__ == "__main__":
    main()

Expected: in every environment, both rays hit the top of their link at z = 1.05 m.

Actual (develop, PhysX on GPU):

env 0: link_a, link_b at [[2.0, -1.5, 1.0], [2.5, -1.5, 1.0]]
       rays hit [[2.0, -1.5, 1.05], [inf, inf, inf]]
env 1: link_a, link_b at [[2.0, 1.5, 1.0], [2.5, 1.5, 1.0]]
       rays hit [[inf, inf, inf], [inf, inf, inf]]
env 2: link_a, link_b at [[-1.0, -1.5, 1.0], [-0.5, -1.5, 1.0]]
       rays hit [[inf, inf, inf], [-0.5, -1.5, 1.05]]

Only the rays of environment 0 on link_a and of environment 2 on link_b hit their link, as the table predicts.

The shipped presets are affected the same way. With a copy of the raycaster_depth64 base camera (four identical
environments, PhysX on GPU, targets reduced to the ground plane and the tracked robot links), each environment's
eight robot slots hold two links of every environment instead of its own eight links: environment 0 holds
iiwa7_link_7 and iiwa7_link_0 of environments 0 to 3, environment 1 holds iiwa7_link_1 and iiwa7_link_2,
and so on. The robot covers 64, 194, 225 and 0 of the 4096 pixels instead of 322 in each environment, and 8 to 10 %
of each depth image is wrong.

System Info

  • Commit: 9b6d2d822a (develop); release/3.0.0 (b63cbde282) has the same code and behaves the same
  • Isaac Sim Version: 6.2.0 (pip)
  • OS: Ubuntu 24.04.2 LTS
  • GPU: NVIDIA RTX PRO 5000 72GB Blackwell
  • CUDA: 13.0
  • GPU Driver: 580.126.20

Additional context

  • The heterogeneous MultiMeshRayCasterCamera test tracks robot links too, but it masks every target-mesh pixel
    with a dilated silhouette before comparing depths (source/isaaclab/test/sensors/test_multi_mesh_ray_caster_camera.py:436-447),
    so it does not see the misplaced links.
  • The PhysX FrameTransformer reads a multi-pattern view the same way and reorders its rows per environment from
    the view's prim paths (source/isaaclab_physx/isaaclab_physx/sensors/frame_transformer/frame_transformer.py:280-288).

Checklist

  • I have checked that there is no similar issue in the repo (required)
  • I have checked that the issue is not in running Isaac Sim itself and is related to the repo

Acceptance Criteria

  • On PhysX, every environment's mesh-table row of a tracked multi-body target holds that environment's own body
    poses, in target order.

Activity

  1. RandomOakForest commented on Oct 16, 2026

    @RandomOakForest
    Collaborator

    Thank you for posting this and adding the PR. The team will review it.

  2. added
    bug
    on Oct 16, 2026
  3. added a commit that references this issue on Oct 22, 2026
    8c9b995
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions