Repository navigation
Place static ray-cast targets in each environment on kitless backends - #8681
Conversation
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.
[Medium impact] Fixes ray-caster target resolution in multi-environment scenes. Fix the two static-target startup failures before merging. FindingsSummaryStatic environment-local ray-cast targets now resolve through
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
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: |
There was a problem hiding this comment.
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.
| 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 |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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: |
There was a problem hiding this comment.
🟡 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) |
There was a problem hiding this comment.
🟡 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.
Description
A multi-mesh ray-cast target inside the environments with
track_mesh_transforms=Falsewas looked up on the USDstage, 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 viewplaces 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:
target that some prototypes lack used to fail the partition check.
/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
Release backport
developrelease/3.0.0has the samebase_multi_mesh_ray_caster.py, clone plan helpers and Newton test file, and the changeapplies 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:
RuntimeError: Target expression '/World/envs/env_[^/]+/Target' matched 2 mesh records, which cannot be evenly partitioned across 4 environments.Tests
test_legacy_multi_mesh_hits_static_target_of_each_envinsource/isaaclab_newton/test/sensors/test_newton_raycast_sensor.py(Newton, MJWarp) and newsource/isaaclab_ov/test/sensors/test_multi_mesh_ray_caster.py(OVPhysX): four environments, one ray perenvironment 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.release/3.0.0(Newton 1.6.1), both new tests fail without the fix and pass with it.develop9b6d2d8 (Newton 1.8.0.dev0, MuJoCo Warp 3.15.0, OVPhysX 0.6.4):test_newton_raycast_sensor.py8 passed; on OVPhysXtest_multi_mesh_ray_caster.py1 passed andtest_ray_caster.py1 passed; on Isaac Sim PhysXsource/isaaclab/test/sensors/test_multi_mesh_ray_caster_camera.py7 passed (including the heterogeneous scene with an untracked
{ENV_REGEX_NS}/Objecttarget) andtest_ray_caster_integration.py6 passed.pre-commit run --files), as doestools/changelog/cli.py check.Related
rows in clone order, so the OVPhysX hits of the heterogeneous cases above also need it; the two merge without
conflicts.
_build_mesh_recordsfor trackedtargets; the two merge without conflicts.
environments lack, since their body view needs a row in every environment; an untracked record carries its own pose,
so such environments hold no copy here. The two merge without conflicts.
Checklist
Docker and GPU tests run on demand. Push the commits you want tested, then
comment
run-cion the pull request.pre-commitchecks withuv run isaaclab --formatsource/<pkg>/changelog.d/for every touched package (do not editCHANGELOG.rstor bump package versions — CI handles that)CONTRIBUTORS.mdor my name already exists there