Repository navigation
Fix Factory nut-thread rotation check for signed Euler angles - #9311
Conversation
There was a problem hiding this comment.
Isaac Lab Review Bot
Needs attention: Style consistency (1). Other reviewed categories look good.
- PR description: Title and diff match; qualify Factory reachability by tested policies and remove the unsupported unit-testing limitation; reported scene checks and rollouts support correctness, and no performance claim requires benchmarks.
- Design and architecture: Architecture looks good.
- Scope and over-engineering: No over-engineering issues.
- API: API changes look good.
- Compatibility and deprecation: No breaking changes identified.
- Implementation: Implementation looks good.
- Style consistency: The wrap_yaw docstring incorrectly describes radians as degrees and includes the excluded lower endpoint; document the output as (-125pi/180, 235pi/180] radians.
- Test quality: Test quality looks good.
Minor fixes needed. Posted 1 inline finding.
Automated review; human maintainers own approval decisions.
|
|
||
| def wrap_yaw(angle): | ||
| """Ensure yaw stays within range.""" | ||
| """Map yaw from [0, 2*pi) to [-125, 235] degrees so the span is not interrupted by the yaw joint limit.""" |
There was a problem hiding this comment.
🟡 Warning · Style Consistency — Correct wrapped yaw units and bounds
wrap_yaw returns radians, not degrees, and excludes the lower bound: its output is equivalent to (-125°, 235°]. State the output range in radians with the correct endpoint.
[Medium impact] The PR appears safe to merge. SummaryFixes the nut-thread rotation check by requesting unsigned Euler angles before calling
No actionable issues found. nfukuchi explicitly omitted a new unit test because the method needs a simulated scene and reported focused simulation checks instead. This review checked the code; it did not rerun those simulations. Reviews (1) · Last reviewed commit: "Fix Factory nut-thread rotation check fo..." · Reviewed by Greptile |
|
run-ci |
# 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)
|
Backported to |
Description
euler_xyz_from_quatreturns 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_yawmoves yaws above 235 degrees down by2*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 requestswrap_to_2pi=Truein the rotation check, and thewrap_yawdocstring 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
Release backport
mainValidation
FactoryEnv._get_curr_successeson 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.ee_success_yaw(0 degrees).main):uv run isaaclab --formatpassed every hook, including the ruff hooks, the license headers and the changelog fragment check.DirectRLEnvmethod that needs a simulated scene, so the only way to unit-test it would be to replay the production expression.Checklist
pre-commitchecks withuv run isaaclab --formatsource/<pkg>/changelog.d/for every touched package (do not editCHANGELOG.rstor bump package versions — CI handles that)CONTRIBUTORS.mdor my name already exists there