Conversation
jeetrex17
force-pushed
the
sap_joint_equality_polynomial
branch
from
September 11, 2026 11:52
ca290c8 to
000c468
Compare
jeetrex17
marked this pull request as ready for review
September 11, 2026 11:53
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Honor the full joint-equality polynomial in SAPCoupler, updating its residual and Jacobian every substep. Support omitted
joint2instead of rejecting it at build time. This also applies to URDF mimic multipliers and offsets.Equality constraints now trigger the SAP solve without contacts, adding per-substep solve overhead: about 69 ms versus 0.12 ms per step on macOS CPU for the 10-DOF test scene, because the SAP Newton, PCG, and line-search launches now run every substep. Regularization now uses the computed Delassus term, which also changes the regularization of existing identity-polynomial equalities.
Related Issue
Resolves #3324.
Rebased on
mainafter #3290 merged.Motivation and Context
SAP previously assumed an identity polynomial and skipped equality-only scenes without contacts, leaving valid joint constraints unenforced.
How Has This Been / Can This Be Tested?
PYTHONPATH="$PWD" QD_OFFLINE_CACHE=0 uv run pytest \ tests/coupling/test_hybrid.py::test_sap_joint_equality_polynomial \ tests/coupling/test_hybrid.py::test_sap_rigid_rigid_hydroelastic_contact \ tests/rigid/test_constraints.py::test_equality_joint_scaling \ -p no:pytest-retry -p no:rerunfailures -q5 passed on macOS CPU (fp64, since SAPCoupler rejects fp32). Pinned Ruff lint and format pass. CUDA and the full suite were not run.
The base fails it: the omitted-joint2 scene is rejected at build, restoring the contact-only gate fails both variants at the correction assertion, and freezing the derivative fails both at the impulse-ratio assertion.
Covered: batched and unbatched, all hinge/slide combinations, scaling, constant offset (a0), all coefficients, derivative updates, omitted
joint2, an unrelated joint. The Delassus path runs but its value is not asserted.scaled_mjcf_joint_equalitiesmoves totests/conftest.pybecausetests/rigidandtests/couplingboth use it. Exact checks use thetolfixture; the one-step residual-ratio bound reflects SAP's constraint regularization, not floating-point error.Checklist:
Submitting Code Changessection of CONTRIBUTING document.