Skip to content

Harden Newton coupled-solver integration - #6

Merged
maxkra15 merged 7 commits into
mmichelis:mym/coupledsolverfrom
maxkra15:maxkra15/pr5834-review-fixes
Jul 14, 2026
Merged

maxkra15 merged 7 commits into
mmichelis:mym/coupledsolverfrom
maxkra15:maxkra15/pr5834-review-fixes

Conversation

@maxkra15

Copy link
Copy Markdown
Collaborator

Description

Depends on #5. This is a review-hardening follow-up for isaac-sim#5834 and targets the same mym/coupledsolver feature branch.

The change keeps the coupler API shape introduced by the parent PR while making unsupported configurations fail at construction, pinning the Isaac Lab/Newton config contract, removing fragile scene wiring from the shipped task, and adding real coupled-solver runtime coverage.

Review issues addressed

Nested solver lifecycle and execution policy

  • Rejects nested CouplerCfg instances and nested model_cfg values instead of silently discarding outer-manager behavior.
  • Rejects Kamino entries until their manager-specific construction, FK, reset, and closed-loop lifecycle can be represented by the nested-entry contract.
  • Rejects MPM entries with project_outside_colliders=True, requires MPM entries to step in_place, and classifies MPM as internally handling contacts.
  • Rejects CPU MJWarp entries because their global reset state cannot preserve the standalone manager's per-world reset-mask guard.
  • Disables CUDA graph capture for sparse/dense MPM grids while retaining it for fixed grids.
  • Moves rigid-deformable coupling_mode validation to construction and types the supported values with Literal.

Ownership, references, and selectors

  • Validates non-empty/unique entry names, entry references, proxy direction, ADMM contact pairs, proximal destinations, native index ranges, and duplicate ownership before Newton construction.
  • Rejects empty entries and partially selected articulation joints; logs per-entry ownership and unassigned model totals.
  • Enforces the current two-entry Proxy limit and keeps cross-entry joints ADMM-only.
  • Makes SceneEntityCfg failures actionable, rejects selector fields whose asset-local semantics cannot be mapped safely, honors preserve_order, and documents ancestor-label regex behavior.
  • Replaces the Franka task's post-hoc scene_cfg alias wiring with self-contained full Newton body-label regexes.

Proxy contacts, materials, and config forwarding

  • Carries Simplify Newton coupler proxy resolution and solver-config forwarding #5's removal of proxy-local shape/material overrides. Proxy bodies now use their source-shape/per-asset material values or NewtonShapeCfg defaults; per-shape overrides remain a separate concern from coupled-solver configuration.
  • Carries Simplify Newton coupler proxy resolution and solver-config forwarding #5's direct proxy-config forwarding and raw body-ID support.
  • Replaces silent field filtering with checked dataclass forwarding for Proxy and ADMM config values so schema drift fails loudly.
  • Covers every exposed ADMM physical field and the non-default Proxy mode, mass scale, collision interval, and factory paths.
  • Narrows collision factories to return a pipeline, validates non-callables early, rejects a factory returning None, preserves outer contacts when collision_pipeline=None is explicit, and reuses one checked wrapper for repeated mappings in the same direction.
  • Moves the contact-sensor guard before construction so rejected configs do not leak global manager state.
  • Removes a stale public lazy-export symbol left by the ADMM contact-pair simplification.

Runtime and documentation

  • Adds CPU-only, kitless tests that construct real pinned-Newton Proxy and ADMM solvers, build nested ModelView instances, prepare contacts, reset, collide, step, and reset again.
  • Expands pure-Python coverage for validation, state isolation, forwarding completeness, graph-capture policy, selector behavior, and collision-pipeline selection.
  • Documents alternating MJWarp+VBD versus Proxy coupling with interaction models, advantages, trade-offs, limitations, and selection guidance.
  • Explains that NewtonCouplerManager inherits NewtonVBDManager intentionally to reuse deformable builder hooks, coloring/finalization, rendering sync, and contact initialization.
  • Corrects the three invalid Isaac-Lift-Soft-Franka-v0 references, the false deformable-to-object migration note, the private-symbol changelog wording, the NewtonShapeCfg description, and the broken cross-package Sphinx reference.

Stacked changelog note

This PR targets an unmerged feature branch. Three in-flight feature fragments are therefore changed in the final branch diff: one change is inherited from #5, and two correct review findings in the parent feature's release notes. The child PR's immutable-fragment check reports those existing paths, but the finalized feature diff passes the actual upstream gate:

./isaaclab.sh -p tools/changelog/cli.py check develop
✓ All modified packages have valid changelog fragments.

New per-package fragments for this follow-up are also included. The intended integration is to merge or squash this draft into mym/coupledsolver, after which isaac-sim#5834 contains the final release-note surface.

Type of change

  • Bug fix
  • Documentation update
  • New feature
  • Released-API breaking change

Validation

  • ./isaaclab.sh -f
  • 69 passed: full source/isaaclab_contrib/test/coupling suite plus construction-time coupling-mode tests
  • Real Proxy and ADMM runtime tests against Newton pin c7ae7c7648cd0717df39e5c94b95d5a02c997320
  • Regression proof on unmodified Simplify Newton coupler proxy resolution and solver-config forwarding #5 head: 10 selected coupler tests failed before the hardening; both coupling-mode tests failed without the early guards
  • ./isaaclab.sh -d: full documentation build succeeded
  • tools/changelog/cli.py check develop: passed
  • Existing AppLauncher rigid/deformable integration test was not run locally because the kitless validation environment does not provide the isaacsim package; CI retains that coverage.

Checklist

  • I have read and understood the contribution guidelines.
  • I have run ./isaaclab.sh --format.
  • I have updated the documentation.
  • My changes generate no new warnings.
  • I have added tests that prove the fixes and runtime contract.
  • I have added a changelog fragment for every touched package.
  • I have added my name to CONTRIBUTORS.md.

@github-actions github-actions Bot added bug Something isn't working documentation Improvements or additions to documentation isaac-lab labels Jul 13, 2026
@@ -324,6 +571,37 @@ def _build_admm_coupled_solver(
coupling = SolverCoupledADMM.Config(**values)
return SolverCoupledADMM(model=model, entries=entries, coupling=coupling)

@staticmethod
def _checked_config_values(target_type: type, config, *, handled_fields: set[str] | None = None) -> dict:

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

We can use the solver filter args function here, why not use that as opposed to another custom function here? If we want to fail loudly, then we should also fail loudly there for the solver args, might as well unify both.

@mmichelis
mmichelis marked this pull request as ready for review July 14, 2026 14:33
maxkra15 added 5 commits July 14, 2026 16:37
Validate ownership, references, nested solver lifecycles, and config forwarding before mutating manager state. Cover the pinned Newton Proxy and ADMM contracts with real CPU runtime tests.
Express supported modes as Literal types and reject invalid values before constructing solvers or mutating shared manager state.
Document alternating and proxy coupling tradeoffs, correct task IDs and release notes, and make the Franka proxy preset self-contained with full body-label regexes.
@mmichelis
mmichelis force-pushed the maxkra15/pr5834-review-fixes branch from 306d490 to c526332 Compare July 14, 2026 14:37
raise ValueError(f"CouplerCfg {field} {name!r} is not one of the configured entries {sorted(entry_names)}.")

@classmethod
def _validate_resolved_entries(

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

A lot of validation code, I guess it's useful to have, but part of me also questions if we should take this job from Newton, or if the coupler from newton side should just check this after we give all the bodies from our side

@mmichelis mmichelis left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Several validation blocks here duplicate checks already performed by Newton. I left focused inline comments on the exact overlaps so Newton can remain the single source of truth for its solver invariants.

names = [entry.name for entry in solver_cfg.entries]
if any(not isinstance(name, str) or not name for name in names):
raise ValueError("CouplerCfg entry names must be non-empty strings.")
duplicate_names = sorted(name for name, count in Counter(names).items() if count > 1)

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Newton already rejects duplicate entry names in SolverCoupled._validate_entry_names(). Can we remove this duplicate check and rely on the native constructor?

Comment on lines +183 to +197
if len(solver_cfg.entries) > 2:
raise ValueError("CouplerProxyCfg supports at most two solver entries.")
for proxy in solver_cfg.proxies:
cls._validate_entry_reference(name_set, proxy.source, "proxy source")
cls._validate_entry_reference(name_set, proxy.destination, "proxy destination")
if proxy.source == proxy.destination:
raise ValueError(
f"CouplerProxyMappingCfg source and destination must differ, got {proxy.source!r}."
)
if proxy.collision_pipeline is not None and not callable(proxy.collision_pipeline):
raise TypeError("CouplerProxyMappingCfg.collision_pipeline must be callable or None.")
if proxy.collision_pipeline is None and proxy.collide_interval is not None:
raise ValueError(
"CouplerProxyMappingCfg.collide_interval requires a proxy-local collision_pipeline."
)

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

This block duplicates Newton's proxy validation: SolverCoupledProxy.__init__() enforces the two-entry limit, _validate_config() checks source/destination references and distinctness, and _build_proxy_collision_configs() checks factory callability and collide_interval. Can we rely on those native checks instead?

Comment on lines +199 to +207
if solver_cfg.contact_pairs is not None:
for source, destination in solver_cfg.contact_pairs:
cls._validate_entry_reference(name_set, source, "ADMM contact-pair source")
cls._validate_entry_reference(name_set, destination, "ADMM contact-pair destination")
if source == destination:
raise ValueError(f"ADMM contact-pair entries must differ, got {source!r}.")
if solver_cfg.joint_proximal_destination_entries is not None:
for name in solver_cfg.joint_proximal_destination_entries:
cls._validate_entry_reference(name_set, name, "ADMM joint-proximal destination")

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Newton already validates ADMM contact-pair references and distinctness in SolverCoupledADMM._setup_admm_contact_specs(), and proximal destination names in _init_admm_joint_proxy_visibility(). It also catches duplicate symmetric contact pairs, which this partial duplicate does not. Can we keep Newton as the single source of truth here?

Comment on lines +233 to +271
owners = {
"bodies": cls._build_ownership_map(model.body_count, entries, "bodies"),
"particles": cls._build_ownership_map(model.particle_count, entries, "particles"),
"joints": cls._build_ownership_map(model.joint_count, entries, "joints"),
"shapes": cls._build_ownership_map(model.shape_count, entries, "shapes"),
}
cls._validate_partial_joint_ownership(model, owners["bodies"])

unassigned = {name: sum(owner is None for owner in values) for name, values in owners.items()}
logger.info(
"[COUPLER] Unassigned model elements: %d bodies, %d particles, %d joints, and %d shapes. "
"Unassigned elements remain outside nested solver views.",
unassigned["bodies"],
unassigned["particles"],
unassigned["joints"],
unassigned["shapes"],
)

if isinstance(solver_cfg, CouplerProxyCfg):
cls._validate_no_cross_entry_proxy_joints(model, {entry.config.name: entry for entry in entries})

@staticmethod
def _build_ownership_map(count: int, entries: list[_ResolvedEntry], field: str) -> list[str | None]:
"""Build one ownership map while validating ranges and overlap."""
owners: list[str | None] = [None] * int(count)
for entry in entries:
for raw_index in getattr(entry, field):
index = int(raw_index)
if not 0 <= index < count:
raise ValueError(
f"CouplerEntryCfg {entry.config.name!r} {field} index {index} is out of range [0, {count})."
)
if owners[index] is not None:
raise ValueError(
f"CouplerCfg {field} index {index} is owned by both {owners[index]!r} "
f"and {entry.config.name!r}."
)
owners[index] = entry.config.name
return owners

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

SolverCoupled already builds ownership maps for bodies, particles, joints, and shapes, and _build_owner_map() rejects out-of-range and multiply owned indices. Could this retain only the minimal body-owner data needed by the adapter-specific partial-joint check and leave range/overlap validation to Newton?

mmichelis and others added 2 commits July 14, 2026 18:25
Delegate native configuration checks to Newton and retain only adapter lifecycle constraints. Preserve proxy collision factories while selecting outer contacts from constructed proxy state.
Simplify coupled solver validation
@maxkra15
maxkra15 merged commit b8c1bed into mmichelis:mym/coupledsolver Jul 14, 2026
11 of 13 checks passed
mmichelis pushed a commit that referenced this pull request Nov 24, 2026
## Description

The Documentation Links job on isaac-sim#9070 fails because the G1 motion preview
was renamed from `g1_cr7.mp4` to `g1_jump_and_turn.mp4` on the
documentation asset host. [Hugging Face PR
#6](https://huggingface.co/datasets/nvidia/isaaclab-docs-assets/discussions/6)
confirms a 100% identical file rename.

Update the G1 motion-tracking guide and Command Builder to use the
renamed asset, preserving both video previews. The old reference is
already on `main`, introduced in isaac-sim#9098.

[Failing link-check
job](https://github.com/isaac-sim/IsaacLab/actions/runs/45206719337/job/137804323431)

## Type of change

- Documentation update

## Validation

- Renamed video URL: HTTP 200; old URL: HTTP 404.
- Lychee v0.24.2 on the updated motion-tracking guide: four links OK,
zero errors.
- `ISAACLAB_CHANGELOG_BASE_REF=upstream/main uv run --no-sync isaaclab
--format`: passed all hooks.
- `node --check docs/source/_static/css/environment-browser.js` and `git
diff --check`: passed.
- Clean Sphinx build attempted locally; blocked during API autosummary
imports by missing simulation dependencies in the minimal macOS
environment. Full documentation build remains for CI.

## Checklist

- [x] I have read and understood the contribution guidelines
- [x] I have run the pre-commit checks with `isaaclab --format`
- [x] I have made corresponding changes to the documentation
- [x] I have validated the changed behavior with focused coverage
- No source package changes or test changes; no changelog fragment
required.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working documentation Improvements or additions to documentation isaac-lab

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants