Skip to content

Fix trimesh object tilt limit when max_yx_angle is in radians - #8074

Merged
StafaH merged 1 commit into
isaac-sim:developfrom
Patrick-SCH03:fix/trimesh-object-max-yx-angle-radians
Sep 27, 2026
Merged

StafaH merged 1 commit into
isaac-sim:developfrom
Patrick-SCH03:fix/trimesh-object-max-yx-angle-radians

Conversation

@Patrick-SCH03

@Patrick-SCH03 Patrick-SCH03 commented Sep 27, 2026 •

Copy link
Copy Markdown
Contributor

Description

make_box, make_cylinder and make_cone in isaaclab/terrains/trimesh/utils.py document max_yx_angle as "the maximum angle along the y and x axis", with degrees choosing the unit. They draw a random rotation, take its "zyx" Euler angles (the x angle lies in [-pi, pi]), and scale the y/x angles:

if degrees:
    max_yx_angle = max_yx_angle / 180.0
euler_zyx[1:] *= max_yx_angle

With degrees=True this caps the x angle at max_yx_angle. With degrees=False the angles are multiplied by the raw radian value, so the cap is exceeded by a factor of pi. Sampling 5000 objects with a 30 degree cap:

call max |x angle| max tilt
max_yx_angle=30.0, degrees=True 29.99 deg 32.4 deg
max_yx_angle=np.deg2rad(30), degrees=False 94.25 deg 94.2 deg

so objects "capped" at 30 degrees can tip past horizontal. Box, cylinder and cone behave the same.

This divides by pi in the radians branch, so both units give the same cap. The degrees=True path is unchanged. No in-repo caller passes degrees=False.

(Separately, the y angle only reaches half the cap on both paths because its Euler range is [-pi/2, pi/2]; I left that alone since changing it would alter existing terrains.)

Type of change

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

Checklist

  • I have read and understood the contribution guidelines
  • I have run the pre-commit checks with ./isaaclab.sh --format
  • I have made corresponding changes to the documentation
  • 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 (do not edit CHANGELOG.rst or bump extension.toml — CI handles that)
  • I have added my name to the CONTRIBUTORS.md or my name already exists there

Testing

  • Added test_object_max_yx_angle_units to test/terrains/test_terrain_generator.py, parametrized over the three functions: with the same seed, a 30 degree cap in degrees and in radians must give the same mesh. It fails for all three on develop and passes with the fix.
  • The whole test_terrain_generator.py passes locally (CPU, with Isaac Sim imports stubbed out).
  • Ruff v0.14.10 (the pre-commit pin) check and format are clean on the changed files. I ran it directly because the full ./isaaclab.sh --format environment isn't available on my Windows machine.

Release backport

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

make_box, make_cylinder and make_cone scale random Euler angles in
[-pi, pi] by max_yx_angle / 180 when degrees=True, which caps the tilt at
max_yx_angle. With degrees=False they scaled by the raw radian value, so
the tilt could exceed the limit by a factor of pi (a 30 degree cap gave
up to about 94 degrees). Divide by pi in that branch so both units give
the same cap. The degrees=True path is unchanged.

Signed-off-by: Patrick-SCH03 <wwoo5241@gmail.com>
@Patrick-SCH03
Patrick-SCH03 requested a review from a team September 27, 2026 03:08
@github-actions github-actions Bot added bug Something isn't working isaac-lab Related to Isaac Lab team labels Sep 27, 2026
@greptile-apps

greptile-apps Bot commented Sep 27, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 5/5

[Medium risk] Fixes terrain object tilt angle unit conversion bug.

The PR appears safe to merge.

Summary

The PR normalizes radian-valued tilt limits for trimesh boxes, cylinders, and cones to match the existing degrees behavior.

  • Adds a seeded regression test comparing meshes generated with equivalent degree and radian limits.
  • Adds a changelog fragment describing the fix.

Reviews (1) · Last reviewed commit: "Fix trimesh object tilt limit when max_y..."

@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 patch consistently normalizes radian max_yx_angle values by π in all three trimesh object helpers, matching the existing degree-path scaling. The parametrized regression test and changelog fragment cover the corrected behavior.

  • Design and architecture: The change preserves the existing normalize-then-scale Euler-angle design and applies the same targeted correction to make_box, make_cylinder, and make_cone without adding dependencies or abstractions.
  • API: Public signatures and defaults remain unchanged. The patch corrects the degrees=False behavior to match the documented unit contract, while preserving the established degrees=True path and recording the user-visible fix in the package changelog.
  • Implementation: The scaling is consistent: 30 / 180 and deg2rad(30) / π both produce the same multiplier. The test reseeds before each call and compares observable mesh vertices across all three helpers, including consistent random section counts for cylinders and cones. Reliance on SciPy's default global random source is a minor test portability consideration, not a demonstrated defect.

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.

@StafaH

StafaH commented Sep 27, 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 Sep 27, 2026
@StafaH
StafaH merged commit a404b87 into isaac-sim:develop Sep 27, 2026
54 checks passed
@isaaclab-bot

isaaclab-bot Bot commented Sep 27, 2026

Copy link
Copy Markdown
Contributor

Backported to release/3.0.0 as 82fe9b5.

isaaclab-bot Bot pushed a commit that referenced this pull request Sep 27, 2026
# Description

`make_box`, `make_cylinder` and `make_cone` in
`isaaclab/terrains/trimesh/utils.py` document `max_yx_angle` as "the
maximum angle along the y and x axis", with `degrees` choosing the unit.
They draw a random rotation, take its `"zyx"` Euler angles (the x angle
lies in `[-pi, pi]`), and scale the y/x angles:

```python
if degrees:
    max_yx_angle = max_yx_angle / 180.0
euler_zyx[1:] *= max_yx_angle
```

With `degrees=True` this caps the x angle at `max_yx_angle`. With
`degrees=False` the angles are multiplied by the raw radian value, so
the cap is exceeded by a factor of pi. Sampling 5000 objects with a 30
degree cap:

| call | max \|x angle\| | max tilt |
|---|---|---|
| `max_yx_angle=30.0, degrees=True` | 29.99 deg | 32.4 deg |
| `max_yx_angle=np.deg2rad(30), degrees=False` | 94.25 deg | 94.2 deg |

so objects "capped" at 30 degrees can tip past horizontal. Box, cylinder
and cone behave the same.

This divides by pi in the radians branch, so both units give the same
cap. The `degrees=True` path is unchanged. No in-repo caller passes
`degrees=False`.

(Separately, the y angle only reaches half the cap on both paths because
its Euler range is `[-pi/2, pi/2]`; I left that alone since changing it
would alter existing terrains.)

## Type of change

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

## Checklist

- [x] I have read and understood the [contribution
guidelines](https://isaac-sim.github.io/IsaacLab/main/source/refs/contributing.html)
- [ ] I have run the [`pre-commit` checks](https://pre-commit.com/) with
`./isaaclab.sh --format`
- [ ] I have made corresponding changes to the documentation
- [x] My changes generate no new warnings
- [x] I have added tests that prove my fix is effective or that my
feature works
- [x] I have added a changelog fragment under
`source/<pkg>/changelog.d/` for every touched package (do **not** edit
`CHANGELOG.rst` or bump `extension.toml` — CI handles that)
- [x] I have added my name to the `CONTRIBUTORS.md` or my name already
exists there

## Testing

- Added `test_object_max_yx_angle_units` to
`test/terrains/test_terrain_generator.py`, parametrized over the three
functions: with the same seed, a 30 degree cap in degrees and in radians
must give the same mesh. It fails for all three on `develop` and passes
with the fix.
- The whole `test_terrain_generator.py` passes locally (CPU, with Isaac
Sim imports stubbed out).
- Ruff v0.14.10 (the pre-commit pin) `check` and `format` are clean on
the changed files. I ran it directly because the full `./isaaclab.sh
--format` environment isn't available on my Windows machine.

## Release backport

- [x] <!-- backport-active-release --> Backport this pull request to the
active release branch after it merges into `develop`

Signed-off-by: Patrick-SCH03 <wwoo5241@gmail.com>

(cherry picked from commit a404b87)
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

None yet

Development

Successfully merging this pull request may close these issues.

2 participants