Repository navigation
Fix FORGE Euler angle ranges during action clipping - #8804
Conversation
Signed-off-by: sujal <[email protected]>
[Low impact] The PR appears safe to merge. Summary
No actionable issues were found. Tests were not executed during this review. Reviews (1) · Last reviewed commit: "Fix FORGE Euler angle ranges during acti..." · Reviewed by Greptile |
There was a problem hiding this comment.
Isaac Lab Review Bot
Needs attention: Scope and over-engineering (1). Other reviewed categories look good.
- PR description: The title and behavior claims match the diff; condense the AST-harness details into one limitation sentence while retaining focused results and missing simulator validation.
- Design and architecture: Architecture looks good.
- Scope and over-engineering: Minimal implementation: extend ForgeEnv._apply_action and delete the two now-unreachable negative-angle normalizations; no source module was added, and keep the regression test, changelog, and contributor entry around the wrapped conversions; Replace with one smaller PR: retain these four files and validate the focused clipping test.
- API: API changes look good.
- Compatibility and deprecation: No breaking changes identified.
- Implementation: Implementation looks good.
- Style consistency: Style consistency looks good.
- Test quality: Test quality looks good.
Minor fixes needed. Posted 1 inline finding.
Automated review; human maintainers own approval decisions.
| desired_roll, desired_pitch, desired_yaw = euler_xyz_from_quat(ctrl_target_fingertip_preclipped_quat) | ||
| # (2.b.i) Get current and desired Euler angles in the positive range expected by roll and yaw clipping. | ||
| curr_roll, curr_pitch, curr_yaw = euler_xyz_from_quat(self.fingertip_midpoint_quat, wrap_to_2pi=True) | ||
| desired_roll, desired_pitch, desired_yaw = euler_xyz_from_quat( |
There was a problem hiding this comment.
🟡 Warning · Scope Complexity — Dead negative-angle normalization left behind
With wrap_to_2pi=True, desired_roll and desired_pitch are already in [0, 2pi), so the torch.where(... < 0.0, ... + 2*pi, ...) lines at 223-224 can never fire and still allocate each control step. Delete both.
AntoineRichard
left a comment
There was a problem hiding this comment.
Thanks for the PR @5usu! I took the liberty to prune the tests.
|
run-ci |
# Description `euler_xyz_from_quat` returns angles in `(-pi, pi]` by default since #2365. `AssemblyEnv._apply_action()` and `DisassemblyEnv._apply_action()` compute the `curr_yaw` attribute with the Factory yaw mapping, which still assumes the former `[0, 2*pi)` range: yaws above 235 degrees are moved down by `2*pi`, so the span `[-125, 235]` degrees is not interrupted by the yaw joint limit. With signed input the mapping does nothing, and a yaw between 180 and 235 degrees comes out between -180 and -125 degrees. This PR requests `wrap_to_2pi=True` for these two calls, as #8804 did for FORGE. Nothing in the repository reads `curr_yaw` today, so there is no behavior change for the current tasks. The fix restores the attribute's intended range so that code reading it, such as a nut-thread style rotation check using `ee_success_yaw` from the AutoMate config, gets the expected value. Related: #8779, #8804 ## Type of change - Bug fix (non-breaking change which fixes an issue) ## Release backport - [x] <!-- backport-active-release --> Backport this pull request to the active release branch after it merges into `main` ## Validation - AutoMate Assembly runs with the change (PhysX), and `curr_yaw` stays in `[-125, 235]` degrees. - Searched the repository: nothing reads `curr_yaw`, so the current tasks are unaffected. - `uv run isaaclab --format` passed every hook, including the ruff hooks, the license headers and the changelog fragment check. - No new unit test. The changed calls live inside `DirectRLEnv` methods that need a simulated scene, so the only way to unit-test them would be to replay the production expression. ## Checklist - [x] I have read and understood the [contribution guidelines](https://isaac-sim.github.io/IsaacLab/main/source/refs/contributing.html) - [x] I have run the [`pre-commit` checks](https://pre-commit.com/) with `uv run isaaclab --format` - [ ] I have made corresponding changes to the documentation (not applicable: no public API change) - [x] My changes generate no new warnings - [x] I have validated the changed behavior with focused coverage and applied the [test-audit criteria](https://github.com/isaac-sim/IsaacLab/blob/HEAD/skills/developer/test-audit/SKILL.md) to any test changes - [x] I have added a changelog fragment under `source/<pkg>/changelog.d/` for every touched package (do **not** edit `CHANGELOG.rst` or bump package versions — CI handles that) - [ ] I have added my name to the `CONTRIBUTORS.md` or my name already exists there
# Description `euler_xyz_from_quat` returns angles in `(-pi, pi]` by default since #2365. `AssemblyEnv._apply_action()` and `DisassemblyEnv._apply_action()` compute the `curr_yaw` attribute with the Factory yaw mapping, which still assumes the former `[0, 2*pi)` range: yaws above 235 degrees are moved down by `2*pi`, so the span `[-125, 235]` degrees is not interrupted by the yaw joint limit. With signed input the mapping does nothing, and a yaw between 180 and 235 degrees comes out between -180 and -125 degrees. This PR requests `wrap_to_2pi=True` for these two calls, as #8804 did for FORGE. Nothing in the repository reads `curr_yaw` today, so there is no behavior change for the current tasks. The fix restores the attribute's intended range so that code reading it, such as a nut-thread style rotation check using `ee_success_yaw` from the AutoMate config, gets the expected value. Related: #8779, #8804 ## Type of change - Bug fix (non-breaking change which fixes an issue) ## Release backport - [x] <!-- backport-active-release --> Backport this pull request to the active release branch after it merges into `main` ## Validation - AutoMate Assembly runs with the change (PhysX), and `curr_yaw` stays in `[-125, 235]` degrees. - Searched the repository: nothing reads `curr_yaw`, so the current tasks are unaffected. - `uv run isaaclab --format` passed every hook, including the ruff hooks, the license headers and the changelog fragment check. - No new unit test. The changed calls live inside `DirectRLEnv` methods that need a simulated scene, so the only way to unit-test them would be to replay the production expression. ## Checklist - [x] I have read and understood the [contribution guidelines](https://isaac-sim.github.io/IsaacLab/main/source/refs/contributing.html) - [x] I have run the [`pre-commit` checks](https://pre-commit.com/) with `uv run isaaclab --format` - [ ] I have made corresponding changes to the documentation (not applicable: no public API change) - [x] My changes generate no new warnings - [x] I have validated the changed behavior with focused coverage and applied the [test-audit criteria](https://github.com/isaac-sim/IsaacLab/blob/HEAD/skills/developer/test-audit/SKILL.md) to any test changes - [x] I have added a changelog fragment under `source/<pkg>/changelog.d/` for every touched package (do **not** edit `CHANGELOG.rst` or bump package versions — CI handles that) - [ ] I have added my name to the `CONTRIBUTORS.md` or my name already exists there (cherry picked from commit 87a150d)
# Description `euler_xyz_from_quat` returns angles in `(-pi, pi]` by default since #2365. `FactoryEnv._get_curr_successes(check_rot=True)`, the nut-thread rotation check (`wrap_yaw(curr_yaw) < ee_success_yaw`), still assumes the former `[0, 2*pi)` range: `factory_utils.wrap_yaw` moves yaws above 235 degrees down by `2*pi`, so the span `[-125, 235]` degrees is not interrupted by the yaw joint limit. With signed input this mapping does nothing, and a yaw between 180 and 235 degrees comes out between -180 and -125 degrees, so it counts as "rotated". #8804 fixed the same assumption in `ForgeEnv._apply_action()`. This PR requests `wrap_to_2pi=True` in the rotation check, and the `wrap_yaw` docstring now states the input range it expects. Factory NutThread cannot reach the affected interval: it starts near 105 degrees yaw and only rotates toward smaller yaw. FORGE NutThread can. Its yaw action is bounded to [-90, 180] degrees in the world frame, and commanding the 180-degree bound makes the hand overshoot to about 182 degrees. If the nut is also pressed down to the success height, the hand has turned the wrong way, yet the check counts it as success. FORGE uses this flag for its success-prediction reward and for the logged success rate. Related: #8779, #8804 ## Type of change - Bug fix (non-breaking change which fixes an issue) ## Release backport - [x] <!-- backport-active-release --> Backport this pull request to the active release branch after it merges into `main` ## Validation - Direct check of `FactoryEnv._get_curr_successes` on Factory and FORGE NutThread (PhysX). The nut is placed at the success pose and the hand yaw is swept from -120 to 235 degrees with roll at pi. - Before: success was reported for every yaw from 180 to 230 degrees. - After: success is reported only for yaw below `ee_success_yaw` (0 degrees). - Rollouts on FORGE NutThread (256 envs, #8804 applied as on `main`): - Pressing the nut down, then commanding the 180-degree yaw bound for the second half of the episode, gave 186 env-steps counted as success before this change and 0 after. The hand yaw reached up to 182 degrees. - Random, hold and other constant-yaw actions kept the yaw below 122 degrees, and both versions agreed on every step. - Rollouts on Factory NutThread under the same action policies: the yaw stayed between -67 and 120 degrees, and both versions agreed on every step. - `uv run isaaclab --format` passed every hook, including the ruff hooks, the license headers and the changelog fragment check. - No new unit test. The changed call lives inside a `DirectRLEnv` method that needs a simulated scene, so the only way to unit-test it would be to replay the production expression. ## Checklist - [x] I have read and understood the [contribution guidelines](https://isaac-sim.github.io/IsaacLab/main/source/refs/contributing.html) - [x] I have run the [`pre-commit` checks](https://pre-commit.com/) with `uv run isaaclab --format` - [ ] I have made corresponding changes to the documentation (not applicable: no public API change) - [x] My changes generate no new warnings - [x] I have validated the changed behavior with focused coverage and applied the [test-audit criteria](https://github.com/isaac-sim/IsaacLab/blob/HEAD/skills/developer/test-audit/SKILL.md) to any test changes - [x] I have added a changelog fragment under `source/<pkg>/changelog.d/` for every touched package (do **not** edit `CHANGELOG.rst` or bump package versions — CI handles that) - [ ] I have added my name to the `CONTRIBUTORS.md` or my name already exists there
# Description `euler_xyz_from_quat` returns angles in `(-pi, pi]` by default since #2365. `FactoryEnv._get_curr_successes(check_rot=True)`, the nut-thread rotation check (`wrap_yaw(curr_yaw) < ee_success_yaw`), still assumes the former `[0, 2*pi)` range: `factory_utils.wrap_yaw` moves yaws above 235 degrees down by `2*pi`, so the span `[-125, 235]` degrees is not interrupted by the yaw joint limit. With signed input this mapping does nothing, and a yaw between 180 and 235 degrees comes out between -180 and -125 degrees, so it counts as "rotated". #8804 fixed the same assumption in `ForgeEnv._apply_action()`. This PR requests `wrap_to_2pi=True` in the rotation check, and the `wrap_yaw` docstring now states the input range it expects. Factory NutThread cannot reach the affected interval: it starts near 105 degrees yaw and only rotates toward smaller yaw. FORGE NutThread can. Its yaw action is bounded to [-90, 180] degrees in the world frame, and commanding the 180-degree bound makes the hand overshoot to about 182 degrees. If the nut is also pressed down to the success height, the hand has turned the wrong way, yet the check counts it as success. FORGE uses this flag for its success-prediction reward and for the logged success rate. Related: #8779, #8804 ## Type of change - Bug fix (non-breaking change which fixes an issue) ## Release backport - [x] <!-- backport-active-release --> Backport this pull request to the active release branch after it merges into `main` ## Validation - Direct check of `FactoryEnv._get_curr_successes` on Factory and FORGE NutThread (PhysX). The nut is placed at the success pose and the hand yaw is swept from -120 to 235 degrees with roll at pi. - Before: success was reported for every yaw from 180 to 230 degrees. - After: success is reported only for yaw below `ee_success_yaw` (0 degrees). - Rollouts on FORGE NutThread (256 envs, #8804 applied as on `main`): - Pressing the nut down, then commanding the 180-degree yaw bound for the second half of the episode, gave 186 env-steps counted as success before this change and 0 after. The hand yaw reached up to 182 degrees. - Random, hold and other constant-yaw actions kept the yaw below 122 degrees, and both versions agreed on every step. - Rollouts on Factory NutThread under the same action policies: the yaw stayed between -67 and 120 degrees, and both versions agreed on every step. - `uv run isaaclab --format` passed every hook, including the ruff hooks, the license headers and the changelog fragment check. - No new unit test. The changed call lives inside a `DirectRLEnv` method that needs a simulated scene, so the only way to unit-test it would be to replay the production expression. ## Checklist - [x] I have read and understood the [contribution guidelines](https://isaac-sim.github.io/IsaacLab/main/source/refs/contributing.html) - [x] I have run the [`pre-commit` checks](https://pre-commit.com/) with `uv run isaaclab --format` - [ ] I have made corresponding changes to the documentation (not applicable: no public API change) - [x] My changes generate no new warnings - [x] I have validated the changed behavior with focused coverage and applied the [test-audit criteria](https://github.com/isaac-sim/IsaacLab/blob/HEAD/skills/developer/test-audit/SKILL.md) to any test changes - [x] I have added a changelog fragment under `source/<pkg>/changelog.d/` for every touched package (do **not** edit `CHANGELOG.rst` or bump package versions — CI handles that) - [ ] I have added my name to the `CONTRIBUTORS.md` or my name already exists there (cherry picked from commit 56ed7fd)
Description
FORGE's action clipping expects positive-range Euler angles for roll correction and the yaw joint-limit mapping. The signed default of
euler_xyz_from_quatmakes a physical roll of 181 degrees appear as -179 degrees, so a target of 180 degrees can command motion away from upright.Explicitly request
wrap_to_2pi=Trueat both conversions inForgeEnv._apply_action(). This preserves existing clipping logic and shared math defaults. Seven focused cases exercise the action method and check commanded orientation and yaw error: roll correction and its step cap, signed pitch correction, and yaw motion along the permitted joint-limit interval. No production dependencies are added.Fixes #8779
Type of change
Validation
Based on current
mainat88f48962e53c003b6eb331d8e70c76515ba724a1._apply_actionandwrap_yawfunction bodies via AST, imports the complete production math module, and executes the committed test cases. It bypasses simulator imports and pytest conftest loading; it does not copy or mock clipping math. The test mocks only the final control-signal sink.ISAACLAB_CHANGELOG_BASE_REF=origin/main uv run --no-project --python ../test-env/bin/python isaaclab --formatin a dedicated uv-managed CPU environment.git diff --checkpassed.Limitations: Normal package-import pytest collection is blocked locally by missing
warpand the simulator dependency environment. The committed test's normal import path and full Isaac Lab/Isaac Sim execution remain unverified. No simulation or training run is claimed. In a configured environment, run:Checklist
isaaclab_tasksCONTRIBUTORS.mdDocumentation changes beyond the changelog are not applicable; no public API changes.