Skip to content

Fix star terrain generation with NumPy 2 - #7519

Closed
ooctipus wants to merge 2 commits into
isaac-sim:developfrom
ooctipus:fix/star-terrain-numpy2
Closed

Fix star terrain generation with NumPy 2#7519
ooctipus wants to merge 2 commits into
isaac-sim:developfrom
ooctipus:fix/star-terrain-numpy2

Conversation

@ooctipus

@ooctipus ooctipus commented Sep 3, 2026

Copy link
Copy Markdown
Collaborator

Description

star_terrain() accessed np.math.cos and np.math.sin, but NumPy 2 removed the np.math alias. Because Isaac Lab requires NumPy 2, every MeshStarTerrainCfg generation failed immediately with AttributeError.

This change uses the standard-library math module that the old NumPy alias exposed, preserving the scalar geometry calculations.

Fixes #6909

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

Screenshots

Not applicable; this fixes a headless terrain-generation crash.

Validation

  • The original headless reproduction succeeds with NumPy 2.5.1 and generates 11 finite meshes.
  • uv run isaaclab -f — all pre-commit hooks passed.

Checklist

  • I have read and understood the contribution guidelines
  • I have run the pre-commit checks with uv run isaaclab -f
  • No documentation change is required because this does not change the public API
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • I have added a changelog fragment under source/<pkg>/changelog.d/ for every touched package
  • My name already exists in CONTRIBUTORS.md

@ooctipus
ooctipus requested a review from a team September 3, 2026 05:49
@github-actions github-actions Bot added bug Something isn't working isaac-lab Related to Isaac Lab team labels Sep 3, 2026
@greptile-apps

greptile-apps Bot commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR restores star-terrain generation under NumPy 2 by replacing the removed numpy.math alias with equivalent standard-library scalar trigonometric functions.

  • Imports Python's math module and uses math.cos and math.sin in all star-bar length branches.
  • Adds a collected unit test that exercises all three trigonometric branches and verifies finite mesh geometry and the expected terrain origin.
  • Adds a changelog fragment documenting the compatibility fix.

Confidence Score: 5/5

The PR appears safe to merge with no actionable correctness, compatibility, or security issues identified.

The standard-library trigonometric functions accept the reachable scalar yaw values and preserve the prior calculations, while the new test executes all three modified branches.

Important Files Changed

Filename Overview
source/isaaclab/isaaclab/terrains/trimesh/mesh_terrains.py Replaces removed NumPy aliases with equivalent standard-library scalar trigonometric calls without changing the geometry calculation.
source/isaaclab/test/terrains/test_mesh_terrains.py Adds a focused regression test whose five yaw values execute every changed branch and validate finite generated geometry.
source/isaaclab/changelog.d/fix-star-terrain-numpy2.rst Accurately documents the NumPy 2 star-terrain generation fix.

Reviews (1): Last reviewed commit: "Fix star terrain generation with NumPy 2" | Re-trigger 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

The PR applies the targeted NumPy 2 compatibility fix by replacing the removed np.math alias with the standard-library math module, with a collected regression test and package changelog fragment.

  • Design and architecture: The change remains localized to star_terrain() and adds no dependency or architectural boundary. Using the standard-library math module directly preserves the original scalar trigonometric implementation.
  • API: No public symbols, configuration fields, defaults, exports, or return types change. Existing callers retain the same terrain-generation contract, and the required changelog fragment is included for the touched package.
  • Implementation: All three yaw branches now call math.cos or math.sin, matching the module previously exposed through np.math. The five-bar test reaches each branch and verifies successful generation, finite vertices, and the expected origin. Its geometry assertions are intentionally broad, so it primarily protects against the reported generation failure rather than exact mesh-shape regressions.

No blocking issues. No inline issue met the actionable-evidence threshold; the assessment above records the review feedback.

Automated review; human maintainers own approval decisions.

@ooctipus

ooctipus commented Sep 3, 2026

Copy link
Copy Markdown
Collaborator Author

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 Sep 3, 2026
@ooctipus ooctipus moved this to In progress in Isaac Lab Sep 3, 2026
@ooctipus ooctipus added this to the Isaac Lab 3.0 GA milestone Sep 3, 2026
@AntoineRichard

Copy link
Copy Markdown
Collaborator

Closing in favor of #6910

@github-project-automation github-project-automation Bot moved this from In progress to Done in Isaac Lab Sep 3, 2026
@ooctipus
ooctipus deleted the fix/star-terrain-numpy2 branch September 3, 2026 08:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working isaac-lab Related to Isaac Lab team

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants