Skip to content

Fix ray mesh triangulation and query shape validation - #8781

Merged
ooctipus merged 2 commits into
isaac-sim:mainfrom
ooctipus:fix/ray-geometry-ranges
Oct 22, 2026
Merged

ooctipus merged 2 commits into
isaac-sim:mainfrom
ooctipus:fix/ray-geometry-ranges

Conversation

@ooctipus

@ooctipus ooctipus commented Oct 22, 2026 •

Copy link
Copy Markdown
Collaborator

Description

USD polygon indices were passed directly to Warp as triangle indices, creating artificial interior faces. Triangulate them with the existing mesh utility before building the ray-caster mesh. A closed six-quad box now reports its outer surface correctly.

Validate identical (..., 3) ray-start and direction shapes before flattening so mismatched arrays cannot reach the native query. This includes the remaining direction-shape validation from #7034; its output-reshape fix and #2416 are already covered on main.

Fixes #3013

The shared distance-output proposal #2946 remains open. Existing raycast_mesh(..., return_distance=True) and Newton's ray_distances output remain available. This PR adds no sensor output or buffer and makes no drift-semantics changes (#4333). It is independent of #8780.

Type of change

  • Bug fix

Validation

  • The existing ray integration fixture checks the six-quad box's analytic outer-surface hits, misses, offsets, and maximum range. Removing the triangulation makes it fail on interior intersections.
  • Existing wrapper tests cover valid scalar/multidimensional ray layouts and output ordering, plus mismatched direction shapes. Removing the shape guard lets the surplus-direction case reach the native query and fail to reject invalid input.
  • 35 passed cases across the existing integration, wrapper, sensor, and Newton test files, including camera projection paths and Newton eager/captured distance queries.
  • Passed formatting, changelog validation, and a file-by-file ownership audit. Only the existing mesh loader and query wrapper change in production; no new modules, helpers, API fields, or buffers.

Checklist

  • I have read and understood the contribution guidelines.
  • I have run the pre-commit checks with uv run isaaclab --format.
  • I have updated the relevant changelog fragment.
  • My changes introduce no new production warnings.
  • I have validated the changed behavior and applied the test-audit criteria.
  • I have added a changelog fragment for every touched package.
  • My name already exists in CONTRIBUTORS.md.

@ooctipus
ooctipus requested a review from a team October 22, 2026 06:47
@github-actions github-actions Bot added bug Something isn't working documentation Improvements or additions to documentation isaac-lab Related to Isaac Lab team labels Oct 22, 2026
@ooctipus

Copy link
Copy Markdown
Collaborator Author

run-ci

@greptile-apps

greptile-apps Bot commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; no actionable issues were found.

Summary

This PR triangulates USD faces before building single-mesh ray-cast meshes and moves non-camera ray ranges into RayCasterData.

  • Single-mesh ray casters triangulate USD polygon faces before casting rays.
  • Ray casters expose geometric ranges through one shared data output.
  • The mesh ray-cast wrapper checks ray shapes before sending them to Warp.

Review checks were static; no tests were run.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[USD face indices and counts] --> B[convert_faces_to_triangles]
    B --> C[Warp mesh]
    C --> D[Single-mesh query]
    D --> G[RayCasterData.ray_distances]
    E[Multi-mesh query] --> G
    F[Newton query] --> G
    D --> H[ray_hits_w]
    H --> I[Existing post-hit height bias]
Loading

Reviews (1) · Last reviewed commit: "Share ray ranges and triangulate USD ray..." · Reviewed by Greptile

@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: Style consistency (1), Test quality (2). Other reviewed categories look good.

  • PR description: The body matches production scope, but validation omits commands and the diff also changes test device selection; list exact pytest invocations and mention that test-only switch.
  • Design and architecture: Architecture looks good.
  • Scope and over-engineering: No over-engineering issues.
  • API: API changes look good.
  • Compatibility and deprecation: No breaking changes identified.
  • Implementation: Implementation looks good.
  • Style consistency: The camera initialization comment drops the skipped-MRO buffer-mirroring invariant, making future parent buffer additions easy to miss; restore that constraint.
  • Test quality: Added tests include cases without distinct observable contracts; delete the private-name source greps and collapse shape parameters to distinct layout behaviors.

Minor fixes needed. Posted 3 inline findings.

Automated review; human maintainers own approval decisions.

# - MultiMeshRayCaster creates _ray_distance_wp / _ray_mesh_id_wp for multi-mesh use
# The camera replaces all of these with its own camera-named equivalents below.
# If either parent class gains new shared buffers, they must be added here explicitly.
# CameraData owns image outputs; initialize its raw ray buffers directly for projection into those images.

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 · Style Consistency — Restore skipped-MRO invariant in comment

The replacement drops the invariant that this override deliberately skips super() and must mirror any buffer the parents allocate; restate that constraint instead of only naming CameraData ownership.

)


@pytest.mark.parametrize(

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 · Test Quality — Collapse redundant parametrize rows

All four direction_shape rows trip the same shape-equality branch, and the three non-scalar leading_shape rows share one flatten/reshape path; keep one row from each matrix.

for path in (root, consumers[0]):
for node in ast.walk(ast.parse(path.read_text())):
if isinstance(node, ast.Attribute):
assert node.attr not in {"_dummy_ray_distance", "_ray_distance_wp", "_dummy_normal_wp"}, path

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 · Test Quality — Source greps assert removed private names

These AST walks only assert that removed private buffer names and a deleted kernel are absent; they break on any rename and duplicate no contract. Delete lines 87-103; the new range tests cover the behavior.

@ooctipus

Copy link
Copy Markdown
Collaborator Author

run-ci

@ooctipus ooctipus changed the title Share ray ranges and triangulate USD ray-cast meshes Fix ray mesh triangulation and query shape validation Oct 22, 2026
@StafaH

StafaH commented Oct 22, 2026

Copy link
Copy Markdown
Collaborator

run-ci

@isaaclab-bot isaaclab-bot Bot added ci:run-docker Trigger the on-demand Docker and GPU CI workflow and removed ci:run-docker Trigger the on-demand Docker and GPU CI workflow labels Oct 22, 2026
@ooctipus ooctipus self-assigned this Oct 22, 2026
@ooctipus
ooctipus merged commit e4df255 into isaac-sim:main Oct 22, 2026
59 checks passed
@ooctipus
ooctipus deleted the fix/ray-geometry-ranges branch October 22, 2026 22:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working documentation Improvements or additions to documentation isaac-lab Related to Isaac Lab team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug Report] Incorrect 2D-LiDAR hit points with RayCaster

2 participants