Skip to content

Place static ray-cast targets in each environment on kitless backends - #8681

Merged
ooctipus merged 7 commits into
isaac-sim:mainfrom
NeoZng:fix/ray-caster-static-env-targets
Oct 20, 2026
Merged

ooctipus merged 7 commits into
isaac-sim:mainfrom
NeoZng:fix/ray-caster-static-env-targets

Conversation

@NeoZng

@NeoZng NeoZng commented Oct 16, 2026

Copy link
Copy Markdown
Contributor

Description

A multi-mesh ray-cast target inside the environments with track_mesh_transforms=False was looked up on the USD
stage, while tracked targets resolve through the clone plan. Without Kit (Newton, OVPhysX), the stage holds only the
clone sources, so every environment got environment 0's copy at environment 0's pose, and a target with several
prototypes failed the even-partition check (#8680).

Untracked targets now resolve through the clone plan like tracked ones: each environment takes its prototype's
source geometry. Where the stage authors the environment's clone, as with Kit, the record is read from that clone, so
those mesh tables are unchanged. Otherwise the source is shifted by the difference of the environment origins
(ClonePlan.positions), which is how the Newton and OVPhysX cloners place the clones and how the OVPhysX frame view
places sites that exist only in the source. Targets outside the environments and scenes without a clone plan still
resolve from the stage.

Behavior changes beyond the kitless placement:

  • In a heterogeneous scene, each environment holds only its own prototype's copy of the target, or none. With Kit, a
    target that some prototypes lack used to fail the partition check.
  • A target that names one environment's prim, such as /World/envs/env_0/Crate, now belongs to that environment only,
    as a tracked target already does. It used to be given to every environment.

Fixes #8680

Type of change

  • Bug fix (non-breaking change which fixes an issue)

Release backport

  • Backport this pull request to the active release branch after it merges into develop

release/3.0.0 has the same base_multi_mesh_ray_caster.py, clone plan helpers and Newton test file, and the change
applies there without conflicts. Both new tests fail there without the fix and pass with it.

Screenshots

One ray per environment straight down onto an untracked target, four environments:

Before After
Newton (MJWarp) and OVPhysX, a crate in every environment environment 0 hits its crate, environments 1-3 miss every environment hits its own crate
OVPhysX, a target with two variants (environments 0-1 and 2-3) RuntimeError: Target expression '/World/envs/env_[^/]+/Target' matched 2 mesh records, which cannot be evenly partitioned across 4 environments. each environment's mesh table holds its own variant; with #8676, the hits match Isaac Sim PhysX
OVPhysX, a box only in environments 0-1 environment 0's box in all four mesh tables the box in the tables of environments 0-1 only; with #8676, hits in environments 0-1, none in 2-3
Isaac Sim PhysX, a box only in environments 0-1 the same partition error hits in environments 0-1, none in 2-3
Isaac Sim PhysX, a crate in every environment, or the two variants each environment's own copy the same mesh tables

Tests

  • New test_legacy_multi_mesh_hits_static_target_of_each_env in
    source/isaaclab_newton/test/sensors/test_newton_raycast_sensor.py (Newton, MJWarp) and new
    source/isaaclab_ov/test/sensors/test_multi_mesh_ray_caster.py (OVPhysX): four environments, one ray per
    environment straight down onto a box or crate that is an untracked target; every hit must be on the top of the
    environment's own copy. On develop, both fail with 9 of 12 values different: environments 1-3 miss.
  • On release/3.0.0 (Newton 1.6.1), both new tests fail without the fix and pass with it.
  • With the fix on develop 9b6d2d8 (Newton 1.8.0.dev0, MuJoCo Warp 3.15.0, OVPhysX 0.6.4):
    test_newton_raycast_sensor.py 8 passed; on OVPhysX test_multi_mesh_ray_caster.py 1 passed and
    test_ray_caster.py 1 passed; on Isaac Sim PhysX source/isaaclab/test/sensors/test_multi_mesh_ray_caster_camera.py
    7 passed (including the heterogeneous scene with an untracked {ENV_REGEX_NS}/Object target) and
    test_ray_caster_integration.py 6 passed.
  • The repository's pre-commit hooks pass on the changed files (pre-commit run --files), as does
    tools/changelog/cli.py check.

Related

Checklist

Docker and GPU tests run on demand. Push the commits you want tested, then
comment run-ci on the pull request.

  • I have read and understood the contribution guidelines
  • I have run the pre-commit checks with uv run isaaclab --format
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have validated the changed behavior with focused coverage and applied the test-audit criteria to any test changes
  • I have added a changelog fragment under source/<pkg>/changelog.d/ for every touched package (do not edit CHANGELOG.rst or bump package versions — CI handles that)
  • I have added my name to the CONTRIBUTORS.md or my name already exists there

A multi-mesh ray caster resolved targets with track_mesh_transforms=False
from the USD stage. Kitless backends author only the clone sources on the
stage, so a static environment-local target matched its source alone and
every environment got the source's pose, and a target with several
prototypes failed to partition across the environments.

Static targets now resolve through the clone plan like tracked targets.
Each environment reads its own clone where the stage authors it, as on
Kit, so those records are unchanged; otherwise the source is placed by the
environment origins, as the clone backends place it. In a heterogeneous
scene each environment holds only the targets of its own prototype.
@NeoZng
NeoZng requested a review from a team October 16, 2026 12:40
@github-actions github-actions Bot added bug Something isn't working isaac-lab Related to Isaac Lab team labels Oct 16, 2026
@greptile-apps

greptile-apps Bot commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 3/5

[Medium impact] Fixes ray-caster target resolution in multi-environment scenes.

Fix the two static-target startup failures before merging.

Findings

  1. P1 Missing children stop sensors ▶
  2. P1 Source numbers break startup ▶

Summary

Static environment-local ray-cast targets now resolve through ClonePlan. Authored clones supply their own poses; missing clones reuse source geometry shifted by environment origins.

  • Static ray targets now stay with the environments that own them.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[Static target] --> B{Matches ClonePlan asset?}
    B -->|No| C[Read targets from USD stage]
    B -->|Yes| D[Find matching source children]
    D --> E{Destination prim exists?}
    E -->|Yes| F[Use destination geometry and pose]
    E -->|No| G[Use source geometry and shift pose]
    F --> H[Append environment mesh record]
    G --> H
Loading

Reviews (1) · Last reviewed commit: "Place static ray-cast targets in each en..." · Reviewed by Greptile

has_rigid_body_api = lambda p: p.HasAPI(UsdPhysics.RigidBodyAPI) # noqa: E731
# Prefer ClonePlan data for env-scoped targets; destination USD prims may not exist.
if plan is not None and target_cfg.track_mesh_transforms:
if plan is not None:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Missing children stop sensors

When two asset variants share {ENV_REGEX_NS}/Object but only one contains Object/Box, the new static route matches both asset roots. It then raises No ClonePlan source prims matched for the variant without Box, before reaching the static branch. The sensor cannot start instead of leaving that variant's environments without this target.

Skip unmatched source children for static targets, while preserving an error when no source matches anywhere.

Comment on lines +247 to +248
source_env = cloner.path.match(source_root, plan.env_template)
source_origin = origins[int(source_env.instance)] if source_env is not None else 0.0

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Source numbers break startup

source_env.instance is an authored source ID, not necessarily an index into plan.positions. Newton supports source IDs outside the destination IDs and uses the first destination's placement in that case. With four destinations and a source such as /World/envs/env_42/Crate, this lookup reads origins[42] and raises IndexError, even when all destination prims exist.

Resolve the source's position using the same source-to-destination mapping as the cloner rather than indexing directly by the path's number.

@isaaclab-review-bot isaaclab-review-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isaac Lab Review Bot

Needs attention: Compatibility and deprecation (1), Implementation (1). Other reviewed categories look good.

  • PR description: The title, rationale, behavior claims, and validation match the diff; rename the image-free “Screenshots” section to “Behavior matrix,” with no benchmark evidence needed for this initialization path.
  • Design and architecture: Architecture looks good.
  • Scope and over-engineering: No over-engineering issues.
  • API: API changes look good.
  • Compatibility and deprecation: Breaking changes: an explicit environment target now belongs only to that environment rather than all environments; add this transition to the changelog fragment.
  • Implementation: The missing-clone path reloads and resolves the same source prim for every environment, scaling initialization work unnecessarily; cache its mesh and pose outside the environment loop.
  • Style consistency: Style consistency looks good.
  • Test quality: Test quality looks good.

Minor fixes needed. Posted 2 inline findings.

Automated review; human maintainers own approval decisions.

has_rigid_body_api = lambda p: p.HasAPI(UsdPhysics.RigidBodyAPI) # noqa: E731
# Prefer ClonePlan data for env-scoped targets; destination USD prims may not exist.
if plan is not None and target_cfg.track_mesh_transforms:
if plan is not None:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Warning · Compatibility — Changelog omits env-scoped target change

Dropping the track_mesh_transforms guard routes an untracked target naming one env's prim (/World/envs/env_0/Crate) through the clone plan, so it now covers that env only instead of all. Record this in the changelog fragment.

prim, offset = source_prim.GetStage().GetPrimAtPath(path), 0.0
if not prim.IsValid():
prim, offset = source_prim, origins[env_id] - source_origin
mesh_id = self._load_target_prim_warp_mesh(prim, target_cfg)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Warning · Implementation — Reload of identical source mesh per env

When the clone prim is missing, prim is the same source_prim for every environment, so the Warp mesh load and resolve_prim_pose repeat num_envs times. Hoist both above the env loop, as the tracked branch does.

Prototypes whose source lacks a static target leave their environments without a copy instead of failing, a source ID outside the environments takes the first environment's place as in the Newton cloner, and a missing clone reuses its source's mesh and pose. The changelog notes the targets that name one environment.
@ooctipus ooctipus added the ci:run-docker Trigger the on-demand Docker and GPU CI workflow label Oct 20, 2026
@ooctipus
ooctipus merged commit f847b1c into isaac-sim:main Oct 20, 2026
58 of 59 checks passed
@NeoZng
NeoZng deleted the fix/ray-caster-static-env-targets branch November 3, 2026 09:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working ci:run-docker Trigger the on-demand Docker and GPU CI workflow isaac-lab Related to Isaac Lab team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug Report] Multi-mesh ray casters on kitless backends give every environment environment 0's static targets

3 participants