Skip to content

Fix FORGE Euler angle ranges during action clipping - #8804

Merged
kellyguo11 merged 2 commits into
isaac-sim:mainfrom
5usu:fix-forge-euler-clipping
Oct 30, 2026
Merged

kellyguo11 merged 2 commits into
isaac-sim:mainfrom
5usu:fix-forge-euler-clipping

Conversation

@5usu

@5usu 5usu commented Oct 24, 2026

Copy link
Copy Markdown
Contributor

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_quat makes 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=True at both conversions in ForgeEnv._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

  • Bug fix

Validation

Based on current main at 88f48962e53c003b6eb331d8e70c76515ba724a1.

  • CPU isolated regression run: 7 passed. Removing both wrapping arguments gives 4 failed, 3 passed (two roll cases and two yaw cases fail).
  • The local isolation harness loads the checkout's actual _apply_action and wrap_yaw function 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.
  • Full repository formatting, lint, and changelog checks passed: ISAACLAB_CHANGELOG_BASE_REF=origin/main uv run --no-project --python ../test-env/bin/python isaaclab --format in a dedicated uv-managed CPU environment.
  • git diff --check passed.

Limitations: Normal package-import pytest collection is blocked locally by missing warp and 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:

uv run python -m pytest source/isaaclab_tasks/test/contrib/test_forge_action_clipping.py

Checklist

  • Read the contribution guidelines and applied the test-audit criteria
  • Ran full repository formatting and pre-commit checks
  • Validated changed behavior with focused before/after CPU coverage, with the isolation boundary described above
  • Added a changelog fragment for isaaclab_tasks
  • Added my name to CONTRIBUTORS.md
  • Normal package-import and simulator validation (requires configured runtime)

Documentation changes beyond the changelog are not applicable; no public API changes.

@5usu
5usu requested a review from a team October 24, 2026 13:03
@github-actions github-actions Bot added bug Something isn't working isaac-lab Related to Isaac Lab team labels Oct 24, 2026
@greptile-apps

greptile-apps Bot commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Low impact] The PR appears safe to merge.

Summary

ForgeEnv._apply_action() now requests positive-range Euler angles for both current and desired orientations.

  • FORGE clips orientation targets using positive-range Euler angles.

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

@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: 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(

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 · 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 AntoineRichard left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR @5usu! I took the liberty to prune the tests.

@AntoineRichard

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 26, 2026
@maxkra15
maxkra15 self-requested a review October 26, 2026 11:05

@maxkra15 maxkra15 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.

lgtm

@kellyguo11
kellyguo11 merged commit f59af6f into isaac-sim:main Oct 30, 2026
59 checks passed
kellyguo11 pushed a commit that referenced this pull request Nov 30, 2026
# 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
isaaclab-bot Bot pushed a commit that referenced this pull request Nov 30, 2026
# 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)
kellyguo11 pushed a commit that referenced this pull request Nov 30, 2026
# 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
isaaclab-bot Bot pushed a commit that referenced this pull request Nov 30, 2026
# 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)
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.

[Bug Report] FORGE roll clipping can move away from the upright target after Euler API migration

5 participants