Conversation
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>
|
There was a problem hiding this comment.
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, andmake_conewithout adding dependencies or abstractions. - API: Public signatures and defaults remain unchanged. The patch corrects the
degrees=Falsebehavior to match the documented unit contract, while preserving the establisheddegrees=Truepath and recording the user-visible fix in the package changelog. - Implementation: The scaling is consistent:
30 / 180anddeg2rad(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.
|
run-ci |
|
Backported to |
# 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)
Description
make_box,make_cylinderandmake_coneinisaaclab/terrains/trimesh/utils.pydocumentmax_yx_angleas "the maximum angle along the y and x axis", withdegreeschoosing 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:With
degrees=Truethis caps the x angle atmax_yx_angle. Withdegrees=Falsethe 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:max_yx_angle=30.0, degrees=Truemax_yx_angle=np.deg2rad(30), degrees=Falseso 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=Truepath is unchanged. No in-repo caller passesdegrees=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
Checklist
pre-commitchecks with./isaaclab.sh --formatsource/<pkg>/changelog.d/for every touched package (do not editCHANGELOG.rstor bumpextension.toml— CI handles that)CONTRIBUTORS.mdor my name already exists thereTesting
test_object_max_yx_angle_unitstotest/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 ondevelopand passes with the fix.test_terrain_generator.pypasses locally (CPU, with Isaac Sim imports stubbed out).checkandformatare clean on the changed files. I ran it directly because the full./isaaclab.sh --formatenvironment isn't available on my Windows machine.Release backport
develop