Repository navigation
Fix body-offset Jacobian in task-space action terms - #7989
Conversation
The DiffIK and OSC action terms shift the body-origin Jacobian to the body_offset frame. The Jacobian is expressed in the root frame, but the correction used the offset in the body frame and also rotated the angular rows by the offset rotation. The offset frame is rigidly attached to the body: its linear velocity is v + w x (R_body_b r) and its angular velocity equals the body's. Rotate the offset into the root frame and leave the angular rows unchanged, matching the pose and the OSC velocity that the terms already compute. Signed-off-by: Lynn <[email protected]>
There was a problem hiding this comment.
Isaac Lab Review Bot
The shared body-offset Jacobian correction is consistent with the surrounding pose and velocity paths, but the helper documentation and new regression test use the wrong quaternion component order. Isaac Lab expects (w, x, y, z), while these additions encode or describe (x, y, z, w).
- Design and architecture: Centralizing the offset shift in a private helper removes duplicated formulas and avoids relying on the end-effector pose computation order. The helper appropriately rotates the lever arm into the root frame while preserving angular Jacobian rows.
- API: Existing action-term signatures and return behavior remain unchanged. However, the helper docstring incorrectly documents
root_quat_wandbody_quat_was(x, y, z, w)even though the articulation data and math utilities use(w, x, y, z); this should be corrected to prevent misuse. - Implementation: The production correction operates on the owned Jacobian buffer and is consistent with the offset velocity calculation. The new test's hand-written root, body, and offset quaternion literals use xyzw ordering, so under Isaac Lab's wxyz convention the stated setup and expected Jacobian do not match. Rewrite the literals in wxyz order.
Minor fixes needed. Posted 2 actionable findings inline.
Automated review; human maintainers own approval decisions.
|
|
||
| Args: | ||
| jacobian_b: Geometric Jacobian of the body origin in the root frame, rows ``[v; w]``. Shape is (N, 6, num_dofs). | ||
| root_quat_w: Root orientation in the world frame (x, y, z, w). Shape is (N, 4). |
There was a problem hiding this comment.
🟡 Warning · Api — Docstring states wrong quaternion component order
root_quat_w and body_quat_w are documented as (x, y, z, w), but the values come from ArticulationData.root_quat_w/body_quat_w and are consumed by math_utils.quat_inv/quat_mul/quat_apply, all of which use Isaac Lab's (w, x, y, z) layout (same as the OffsetCfg.rot default (1, 0, 0, 0)). Document (w, x, y, z) so future callers of this shared helper are not misled.
There was a problem hiding this comment.
On develop the math utilities and data use scalar-last (x, y, z, w):
quat_mul/quat_apply/quat_invdocument "(x, y, z, w)" (isaaclab/utils/math.py).DifferentialInverseKinematicsActionCfg.OffsetCfg.rotandOperationalSpaceControllerActionCfg.OffsetCfg.rotdefault to(0.0, 0.0, 0.0, 1.0)and are documented as(x, y, z, w)(actions_cfg.py).
The test values are therefore identity and a 90° rotation about z. The test fails on the previous formula and passes with this change, which would not happen with the other ordering. Leaving these as they are.
| The body-origin Jacobian is ``v = 0`` and ``w = z``. A point ``r`` fixed on the body moves with | ||
| ``w x (R_body_b @ r)`` and turns with the body's angular velocity. | ||
| """ | ||
| body_quat_w = torch.tensor([[[0.0, 0.0, math.sin(math.pi / 4.0), math.cos(math.pi / 4.0)]]]) |
There was a problem hiding this comment.
🟡 Warning · Implementation — Test stub quaternions use xyzw layout
root_quat_w=[0,0,0,1] and body_quat_w=[0,0,sin45,cos45] are identity and a 90 deg z-rotation only in xyzw. Read as wxyz, body_quat_b becomes 90 deg about x, offset_pos_b stays (1,0,0), and the linear column is z x (1,0,0) = (0,1,0), so the assertion against (-1,0,0) does not hold. Rewrite both literals (and offset_rot) w-first.
There was a problem hiding this comment.
On develop the math utilities and data use scalar-last (x, y, z, w):
quat_mul/quat_apply/quat_invdocument "(x, y, z, w)" (isaaclab/utils/math.py).DifferentialInverseKinematicsActionCfg.OffsetCfg.rotandOperationalSpaceControllerActionCfg.OffsetCfg.rotdefault to(0.0, 0.0, 0.0, 1.0)and are documented as(x, y, z, w)(actions_cfg.py).
The test values are therefore identity and a 90° rotation about z. The test fails on the previous formula and passes with this change, which would not happen with the other ordering. Leaving these as they are.
|
…ts (#8018) ## Description Completes the missing `develop` backports to `release/3.0.0` from the 48-hour audit window ending September 25, 2026 at 05:55 UTC. Of 30 merged source PRs, 25 were already present on release, three had no backport, and two had inferred draft backports. - #7978: report Newton reaction wrenches for fixed connections while preserving articulation control-joint ownership. - #7997: correct OVPhysX joint-wrench frames and move the shared analytic sensor contract into the test tree. - #7989: correct body-offset Jacobians in task-space actions without mutating backend buffers. - #8010 and #8009: backport the OVPhysX and PhysX test audits after their wrench prerequisite. All five source patches apply without conflicts in this order. This supersedes the now-closed inferred draft backports #8016 and #8017, which were generated without #7997 and adapted their sensor tests around the old release implementation. Source commit hashes are recorded in the commit message. ## Validation - Audited all 778 paths touched by the 30 source PRs. Remaining differences in those paths are existing release metadata, cloning documentation, a CLI test version example, and release-only renderer tests. - **55 focused checks passed:** 6 Jacobian/shared-contract unit tests, 14 Newton sensor tests, 9 OVPhysX sensor tests across CPU/GPU, 9 PhysX sensor tests, 14 changed shared-ordering cases, and 3 live PhysX OSC tracking/gravity cases. Seven PhysX ordering variants skipped in the direct invocation; the live PhysX checks ran separately with Kit. - Backend validation used Newton 1.6.0, Warp 1.17.0, OVPhysX 0.6.3, and the pinned Isaac Sim 6.1.0 installation. Package imports were verified to resolve to this backport checkout. - `uv run --no-sync isaaclab -f`, `git diff --check`, and the full `make -C docs current-docs` build with warnings as errors passed. - Additional renderer contract coverage: 53 passed; two live-render cases could not initialize the local native CRenderApi library despite installing the pinned `ov` extra. Full Docker/GPU CI is running on the PR head. - The broader shared ordering file has 14 OVPhysX failures on both this branch and unchanged release, with identical failing node IDs and no added failures. The changed cases listed above passed. ## Controller coverage review The live PhysX OSC tests remain in `source/isaaclab/test/controllers/test_operational_space.py`; its fixture uses `SimulationCfg`'s default `PhysxCfg`, and the file is included in CI. The existing absolute-pose tracking, gravity-compensation, and nullspace-centering cases passed against Isaac Sim 6.1.0. The test audit removes the duplicate asset-suite cases while retaining this controller-suite coverage. ## Existing release CI failures The latest [release run](https://github.com/isaac-sim/IsaacLab/actions/runs/36097576980) and [develop run](https://github.com/isaac-sim/IsaacLab/actions/runs/36099567240) fail the same five OvStage image comparisons in `rendering-correctness-kitless (ovstage)` and `ovrtx-cache-warm`: Cartpole on Newton and OVPhysX, plus Newton Franka cable, cloth, and soft. Cartpole is 2.03–2.04% different against a 1.50% threshold on both branches; cloth is 32.48% on both. These shared rendering failures predate this catch-up; this PR does not change rendering output or image thresholds. ## Checklist - [x] Contribution guidance followed and formatting checks passed - [x] Original package changelog fragments and documentation included - [x] File-by-file backport audit completed - [x] Warning-free documentation build completed - [ ] Full CI completed Targets `release/3.0.0`; no further backport is needed.
# Description A task-space action with `body_offset` needs a Jacobian at the offset point. The core DiffIK and OSC actions received the corrected frame convention in #7989, but the Newton model-free action retained its own formula: it used a body-local lever arm against a root-frame Jacobian and rotated the angular rows by the offset orientation. With a rotated body or root, `J @ qdot` therefore disagreed with the offset-frame twist. This PR fixes the Newton action by rotating the offset into world axes, applying `Jv_point = Jv_origin + Jw × r`, and then rotating the Jacobian into root axes. The angular rows stay unchanged. Core DiffIK and OSC now use the same direct `torch.linalg.cross` operation in root axes instead of constructing a skew matrix and multiplying it by the angular Jacobian. The two forms are mathematically equivalent; the direct cross product avoids an extra matrix allocation and multiplication. No new math wrapper is needed. The Newton task-space actions use Newton's model-free controllers, which require a caller-supplied tool-point pose and Jacobian. Newton's separate model-based controllers and IK objectives support tool-site/link offsets, but are not the controller API used here. The Newton action continues to accept both Newton and PhysX asset data through the public link-origin Jacobian contract. On the official Franka validation from the original fix (rotated fixed root and a hand offset), `J @ qdot` matched the simulator's offset-frame twist: Newton linear error fell from about 0.27 m/s to 2e-6 m/s and angular error from about 0.95 rad/s to 1e-7 rad/s. PhysX errors were 1e-4 to 4e-4, matching the core term's floor. Only configurations with `body_offset` are affected; no shipped task currently uses these Newton action terms. Fixes #8202 ## Type of change - Bug fix and task-space offset performance improvement ## Release backport - [x] Backport this pull request to the active release branch after it merges into `develop` ## Validation - `uv run --frozen --extra test python -m pytest source/isaaclab/test/envs/test_diffik_jacobian_aliasing.py -q` — 5 passed. - `uv run --frozen --extra test python -m pytest source/isaaclab_newton/test/controllers/test_newton_controllers.py -q` — 8 passed; the existing DiffIK case now checks the offset Jacobian. - `uv run --frozen isaaclab -f` — passed with the local changelog base set to this PR's upstream base commit. - 4,096-env, 7-joint Torch GPU microbenchmarks on RTX 5090 (median of 8 paired rounds of 100 calls): Newton world-frame point shift, direct cross 149.6 us/call versus skew matrix 213.5 us/call; core root-frame point shift, direct cross 107.0 us/call versus skew matrix 181.0 us/call. These measure Jacobian computation, not a full simulation step. ## Checklist - [x] I have read and understood the contribution guidelines. - [x] I have run the pre-commit checks. - [x] I have added changelog fragments for both touched packages. - [x] The focused regression tests pass. - [ ] I have made corresponding changes to the documentation. --------- Co-authored-by: Octi Zhang <[email protected]>
…c-sim#8203) # Description A task-space action with `body_offset` needs a Jacobian at the offset point. The core DiffIK and OSC actions received the corrected frame convention in isaac-sim#7989, but the Newton model-free action retained its own formula: it used a body-local lever arm against a root-frame Jacobian and rotated the angular rows by the offset orientation. With a rotated body or root, `J @ qdot` therefore disagreed with the offset-frame twist. This PR fixes the Newton action by rotating the offset into world axes, applying `Jv_point = Jv_origin + Jw × r`, and then rotating the Jacobian into root axes. The angular rows stay unchanged. Core DiffIK and OSC now use the same direct `torch.linalg.cross` operation in root axes instead of constructing a skew matrix and multiplying it by the angular Jacobian. The two forms are mathematically equivalent; the direct cross product avoids an extra matrix allocation and multiplication. No new math wrapper is needed. The Newton task-space actions use Newton's model-free controllers, which require a caller-supplied tool-point pose and Jacobian. Newton's separate model-based controllers and IK objectives support tool-site/link offsets, but are not the controller API used here. The Newton action continues to accept both Newton and PhysX asset data through the public link-origin Jacobian contract. On the official Franka validation from the original fix (rotated fixed root and a hand offset), `J @ qdot` matched the simulator's offset-frame twist: Newton linear error fell from about 0.27 m/s to 2e-6 m/s and angular error from about 0.95 rad/s to 1e-7 rad/s. PhysX errors were 1e-4 to 4e-4, matching the core term's floor. Only configurations with `body_offset` are affected; no shipped task currently uses these Newton action terms. Fixes isaac-sim#8202 ## Type of change - Bug fix and task-space offset performance improvement ## Release backport - [x] Backport this pull request to the active release branch after it merges into `develop` ## Validation - `uv run --frozen --extra test python -m pytest source/isaaclab/test/envs/test_diffik_jacobian_aliasing.py -q` — 5 passed. - `uv run --frozen --extra test python -m pytest source/isaaclab_newton/test/controllers/test_newton_controllers.py -q` — 8 passed; the existing DiffIK case now checks the offset Jacobian. - `uv run --frozen isaaclab -f` — passed with the local changelog base set to this PR's upstream base commit. - 4,096-env, 7-joint Torch GPU microbenchmarks on RTX 5090 (median of 8 paired rounds of 100 calls): Newton world-frame point shift, direct cross 149.6 us/call versus skew matrix 213.5 us/call; core root-frame point shift, direct cross 107.0 us/call versus skew matrix 181.0 us/call. These measure Jacobian computation, not a full simulation step. ## Checklist - [x] I have read and understood the contribution guidelines. - [x] I have run the pre-commit checks. - [x] I have added changelog fragments for both touched packages. - [x] The focused regression tests pass. - [ ] I have made corresponding changes to the documentation. --------- Co-authored-by: Octi Zhang <[email protected]> (cherry picked from commit e67c5cb)
Description
DifferentialInverseKinematicsAction._compute_frame_jacobianandOperationalSpaceControllerAction._compute_ee_jacobianshift the body-origin Jacobian to thebody_offsetframe.jacobian_bis the body-origin geometric Jacobian expressed in the root frame. The previous correction had two problems:-[r]× J_wwithr = body_offset.posin the body frame. The offset point moves withv + w × (R_body_b r), so the lever arm has to be rotated into the root frame first. The two only coincide when the body's orientation in the root frame is identity. For the Franka IK tasks (pos=(0, 0, 0.107), hand pointing down), the lever arm's sign is effectively flipped.R(body_offset.rot). The offset frame is rigidly attached to the body, so its angular velocity in the root frame equals the body's, and the angular rows must stay unchanged.The same terms already compute the offset frame's pose correctly (
combine_frame_transforms(link_pose_b, offset)). The OSC term also computes its velocity correctly (v + w × quat_apply(link_quat_b, offset_pos), with a comment that angular velocity is unaffected). So the Jacobian was inconsistent with both.Both action terms apply the correction inline. They compute the body orientation in the root frame directly from the asset data, so the result does not depend on whether
_compute_ee_poseran earlier in the step: the OSCapply_actionscomputes the Jacobian before the pose.Type of change
Tests
source/isaaclab/test/envs/test_diffik_jacobian_aliasing.pywith the body-offset regression (kit-freeunit, parametrized over DiffIK and OSC), reusing its existing stub.(1, 0, 0), the expected linear column isz × (0, 1, 0) = (-1, 0, 0). With a 90° offset rotation about x, the angular column must stay(0, 0, 1).test_diffik_jacobian_aliasing.py::test_compute_frame_jacobian_applies_offset_once.Finite-difference check (script not included in the PR):
(0, 0, 0.107), 0.7 rad offset rotation.Notes for reviewers
body_offset(e.g. the Franka lift/stack/cabinet IK tasks) will now use the correct Jacobian. DiffIK is closed-loop, so the previous error mostly degraded convergence rather than causing outright failures. For OSC with inertial decoupling, the mismatch betweenJand the (correct) EE velocity is removed.Checklist
pre-commitchecks with./isaaclab.sh --formatsource/isaaclab/changelog.d/CONTRIBUTORS.mdor my name already exists there