Skip to content

[Newton] Consolidate differential IK, joint impedance, and OSC controllers - #7854

Merged
ooctipus merged 30 commits into
isaac-sim:developfrom
hujc7:jichuanh/newton-controllers-unified-codex
Sep 24, 2026
Merged

ooctipus merged 30 commits into
isaac-sim:developfrom
hujc7:jichuanh/newton-controllers-unified-codex

Conversation

@hujc7

@hujc7 hujc7 commented Sep 16, 2026 •

Copy link
Copy Markdown
Collaborator

Description

Added Newton 1.6 model-free differential IK, joint impedance, and OSC through cfg.use_newton=True; the original Lab controllers remain the default. Consolidates #6693, #7482, and the differential-IK portion of #6654. Ackermann remains in its separate draft.

Both paths share constructor, command, and compute signatures and return independent results. Controller selection is independent of the physics backend. Newton initializes from compute inputs, or from supplied DiffIK limits when avoidance is enabled. Existing callers and tutorials retain their setup; SO101 retains its wrist-orientation mask through a Newton-only Jacobian adaptation.

Newton uses float32 computation. Its OSC selects motion before inertia decoupling, requires at least six joints for decoupling, and retains motion-force coupling that fails three hybrid force-tracking cases. Those Newton cases run as strict expected failures; Lab cases remain active, and thresholds are unchanged. Convergence checks now apply masks in the actual control frame.

Newton DiffIK requires joint limits before the first compute when avoidance is enabled; later limit updates retain its buffers. Its pinv also rejects fewer controlled joints than active task axes. These differences prevent blanket replacement of the Lab path. Joint impedance retains the same control law, subject to Newton's precision boundary. Includes the position-only SVD and joint-impedance gain-clamping/batched-inertia fixes.

Type of change

  • New feature, bug fix, documentation update

Release backport

  • Backport to the active release branch

Validation

  • Post-merge CPU controller suite: 204 passed, 3 CUDA capture tests skipped. Formatting and changelog checks passed.
  • Focused GPU hybrid simulation with current controller/test overlays, 16 environments: 3 Lab passed, 3 Newton xfailed. This was not a full-repository run of the final head.
  • Warning-free current documentation build passed.
  • Matched full-policy Lab/Newton videos were recorded for Reach-Franka-OSC on PhysX/MJWarp and Drawer DiffIK on MJWarp. SO101 keyboard rollout and training equivalence remain unverified.
  • Fresh Docker/GPU CI requested for the updated head; results pending.

Checklist

  • Contribution guidelines followed; contributor already listed
  • Pre-commit checks run with uv run isaaclab -f
  • Documentation and package changelog fragments updated
  • Both-backend and regression tests added
  • Newton hybrid force-tracking limitations resolved
  • Changes generate no new warnings

@hujc7
hujc7 marked this pull request as ready for review September 16, 2026 22:35
@hujc7
hujc7 requested a review from a team September 16, 2026 22:35
@greptile-apps

greptile-apps Bot commented Sep 16, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 4/5

The PR is not safe to merge while three retained OSC simulation scenarios regress relative to the base implementation.

Findings

  1. P1 OSC Simulation Paths Regress ▶
  2. P2 SO-101 Rollout Is Unverified ▶

Summary

This PR replaces the differential-IK, joint-impedance, and operational-space controller implementations with Newton 1.6.0 model-free adapters, introduces persistent Torch/Warp port storage, requires fixed joint counts for DiffIK and OSC, and updates action terms, SO-101 specialization, documentation, and tests.

  • DiffIK now delegates solver methods and optional joint-limit avoidance to Newton.
  • Joint impedance delegates its control law while retaining Isaac Lab command shaping and gain scheduling.
  • OSC delegates motion, wrench, inertia, gravity, and null-space control using operational-frame ports.
  • The OSC migration still has three acknowledged simulation regressions that pass on the base implementation.
  • SO-101’s Newton-backed wrist-mask path lacks simulation-level rollout validation.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart LR
  A[Policy or standalone caller] --> B[Isaac Lab command shaping]
  B --> C{Controller}
  C --> D[Differential IK adapter]
  C --> E[Joint impedance adapter]
  C --> F[Operational-space adapter]
  D --> G[Persistent Torch/Warp input ports]
  E --> G
  F --> G
  G --> H[Newton 1.6 model-free step]
  H --> I[Joint position or effort snapshot]
  F --> J[Hybrid and task-frame simulation paths]
  J --> K[Three retained tests currently fail]
Loading

Reviews (1) · Last reviewed commit: "Merge remote-tracking branch 'upstream/d..."

Comment on lines +477 to +482
motion_selection_axes=(
wp.spatial_vector(*self.cfg.motion_control_axes_task) if self._wrench_control else None
),
wrench_selection_axes=(
wp.spatial_vector(*self.cfg.contact_wrench_control_axes_task) if self._wrench_control else None
),

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.

P1 OSC Simulation Paths Regress

The new pre-inertia motion-axis selection is not compatible with the retained OSC configurations. test_franka_hybrid_variable_kp_impedance, test_franka_taskframe_hybrid, and test_franka_taskframe_hybrid_with_nullspace_centering pass with the original controller but fail with this adapter. These hybrid and task-frame paths therefore produce incorrect tracking or force-control behavior until the Newton mapping or affected configurations are corrected.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

The force-tracking limitation remains; it has not been fixed by the adapter cleanup. Lab is now the default and Newton is explicitly selected with cfg.use_newton=True. The three Newton hybrid cases still execute as strict xfails, with unchanged convergence thresholds and active Lab counterparts. The task-frame convergence metric was also corrected. This keeps the unsupported Newton behavior visible while preserving the default Lab path; the PR description documents the limitation.

@hujc7

hujc7 commented Sep 17, 2026

Copy link
Copy Markdown
Collaborator Author

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 Sep 17, 2026
StafaH and others added 8 commits September 22, 2026 15:01
Write controller targets in place on both paths so the Newton branch no
longer needs special handling in set_command. Drop tests that checked
private buffers or the convergence test helper, fold the late-limit
check into the existing feature test, and condense the docs and
changelog.
Replace the use_newton flag with implementation: Literal["native", "newton"]
on the differential IK, joint impedance, and operational-space controller
configurations, and shorten the config docstrings to one line.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
The differential IK and operational-space controllers take an optional
num_joints argument, required for the Newton implementation, so the
Newton solver is built once in __init__ instead of lazily on the first
compute call. compute() now only dispatches to _compute_lab() or
_compute_newton(), and joint-limit avoidance no longer requires limits
before the first compute call.

The Newton path binds the caller's tensors to Newton's input ports with
wp.from_torch on each call instead of copying them into port buffers.
Only data Isaac Lab must transform, such as packed poses and gain
diagonals, is staged.

The action terms, SO-101 controller, and keyboard reset IK pass
num_joints, and the tests, docs, and changelog are updated.
When no task frame was given, set_command built an identity pose from
a num_envs-row Python list and uploaded it on every call, so its cost
grew with the number of environments. It now reuses a preallocated
identity root-frame pose, which also replaces the per-call fallback
quaternion upload.

The gains and selection matrices are block diagonal, so rotating each
3x3 block into the root frame is one 6x6 rotation. They are now rotated
together in one batched product instead of 16 separate block products.
set_command drops from 1.0/2.5/8.5 ms to about 0.4 ms at 1k/4k/16k
environments, for both implementations.
Merge the feature and Newton integration tests into test_differential_ik.py.
Numerical tests now run both implementations on the same inputs and check
isaaclab == newton == reference; the sim convergence tests compare both
controllers every step. Drop tests of private helpers already covered by the
reference comparison, store joint limits as float32 so the Isaac Lab
implementation accepts float64 limits like Newton, and re-enable the file in CI.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Merge the OSC feature and Newton integration tests into
test_operational_space.py and rename the joint impedance Newton test to
test_joint_impedance.py. Tests now run both implementations and check them
against each other and a reference. OSC sim tests compare both controllers
every step where the laws agree.

The per-step comparison showed that Newton OSC ignores
inertia_conditioning_thresholds and diverges near singularities under full
inertial decoupling. Keep those sim tests per implementation, mark the
conditioning unit tests as strict xfail for Newton, and document the
difference in the config docstring and changelog.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@StafaH

StafaH commented Sep 24, 2026

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 Sep 24, 2026
@StafaH StafaH self-assigned this Sep 24, 2026
ooctipus added a commit that referenced this pull request Sep 24, 2026
# Description

`DifferentialInverseKinematicsAction._compute_frame_jacobian` and
`OperationalSpaceControllerAction._compute_ee_jacobian` shift the
body-origin Jacobian to the `body_offset` frame. `jacobian_b` is the
body-origin geometric Jacobian expressed in the **root** frame. The
previous correction had two problems:

1. **Translational rows.** The correction used `-[r]× J_w` with `r =
body_offset.pos` in the **body** frame. The offset point moves with `v +
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.
2. **Angular rows.** They were multiplied by `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_pose` ran earlier in the
step: the OSC `apply_actions` computes the Jacobian before the pose.

## Type of change

- Bug fix (non-breaking change which fixes an issue)

## Tests

- Extended `source/isaaclab/test/envs/test_diffik_jacobian_aliasing.py`
with the body-offset regression (kit-free `unit`, parametrized over
DiffIK and OSC), reusing its existing stub.
- Setup: one revolute joint about z, with the body rotated 90° about z.
- With offset `(1, 0, 0)`, the expected linear column is `z × (0, 1, 0)
= (-1, 0, 0)`. With a 90° offset rotation about x, the angular column
must stay `(0, 0, 1)`.
- **Updated**
`test_diffik_jacobian_aliasing.py::test_compute_frame_jacobian_applies_offset_once`.
- Its out-of-place reference encoded the previous formula. It now uses
non-trivial root and body orientations and the rigid-offset formula.
  - The idempotence and owned-buffer tests are unchanged and still pass.

```
pytest -q source/isaaclab/test/envs/test_diffik_jacobian_aliasing.py
# without the fix: 3 failed, 2 passed
# with the fix:    5 passed
```

**Finite-difference check** (script not included in the PR):
- Setup: random 7-joint serial chain in float64, offset `(0, 0, 0.107)`,
0.7 rad offset rotation.
- Comparison: the Jacobian of the offset frame against finite
differences of its pose.

| | max linear error | max angular error |
|---|---|---|
| previous formula | 7.9e-2 | 6.1e-1 |
| this PR | 4.7e-7 | 2.4e-7 |

## Notes for reviewers

- **Changed behavior for existing tasks.** Tasks that set `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 between `J` and the (correct) EE velocity is
removed.
- **Scope.** I kept the change local to the two action terms. It should
not overlap with the controller consolidation in #7854, which does not
touch these methods.

## Checklist

- [x] I have read and understood the contribution guidelines
- [x] I have run the `pre-commit` checks with `./isaaclab.sh --format`
- [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/isaaclab/changelog.d/`
- [x] I have added my name to the `CONTRIBUTORS.md` or my name already
exists there

---------

Signed-off-by: Lynn <[email protected]>
Co-authored-by: Octi Zhang <[email protected]>
Replace the implementation switch on the Isaac Lab controller configs with
separate Newton controllers. NewtonDifferentialIKController,
NewtonJointImpedanceController, and NewtonOperationalSpaceController wrap
the model-free controllers in newton.controllers and expose their full
configuration. NewtonDifferentialInverseKinematicsActionCfg and
NewtonOperationalSpaceControllerActionCfg drive them from manager-based
environments.

Move isaaclab_newton.ik to isaaclab_newton.controllers.ik.

Restore the Isaac Lab controllers and action terms to their previous
interface, keeping the controller fixes and the set_command speedup, and
make the controller tests Isaac Lab only.
@StafaH

StafaH commented Sep 24, 2026

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 Sep 24, 2026
@ooctipus
ooctipus merged commit 481a676 into isaac-sim:develop Sep 24, 2026
53 of 54 checks passed
StafaH added a commit that referenced this pull request Sep 24, 2026
… OSC (#7854) (#8013)

## Description

Backports #7854 to `release/3.0.0` from merged commit
`481a676a993b4054f46556ebd2c14a155b87602f`. The cherry-pick applied
cleanly; every changed or deleted file matches the merged source commit
exactly.

Adds Newton differential IK, joint impedance, and operational-space
controllers and their task-space actions. Moves the Newton IK package to
`isaaclab_newton.controllers.ik` and updates its callers and API
documentation. Includes the original Lab controller fixes, consolidated
tests, and changelog fragments. Newton remains pinned to 1.6.0.

## Validation

- **170 focused tests passed** against Newton 1.6.0: Newton controller
wrappers and IK solver, Lab joint impedance, differential IK and OSC
numerical regressions (including available CUDA cases), SO101 IK, and
Reach presets.
- `isaaclab -f`: all formatting, lint, changelog, and other pre-commit
checks passed.
- Audited the moved/deleted paths and checked for stale
`isaaclab_newton.ik` imports.
- Full robot simulation tests and a documentation build were not run
locally for this backport. Existing TorchScript deprecation warnings
remain. The initial combined test harness crashed after importing Newton
before Kit; isolated core runs with Kit loaded first passed.

Signed-off-by: Octi Zhang <[email protected]>
Co-authored-by: hujc <[email protected]>
Co-authored-by: Mustafa H <[email protected]>
Co-authored-by: Mustafa Haiderbhai <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation infrastructure isaac-lab Related to Isaac Lab team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants