Skip to content

[Bug]: SAPCoupler ignores the polynomial of MJCF joint equalities. #3324

Description

@duburcqa

Bug Description

SAPCoupler maps a JOINT equality to q1 - q2 = 0: build_constraints in genesis/engine/couplers/sap_coupler.py writes Jt = [1, -1] and compute_regularization takes g0 = q[i_dof1] - q[i_dof2], whatever eq_data holds. The rigid constraint solver honors the full contract, q1 - q1_0 = a0 + a1 * d + a2 * d^2 + a3 * d^3 + a4 * d^4 with d = q2 - q2_0, and after #3290 a missing joint2 as d = 0. So the two couplers simulate different constraints from the same MJCF whenever polycoef differs from 0 1 0 0 0 or joint2 is omitted. #3290 rejects the omitted-joint2 form at build in the SAP coupler; the non-identity polynomial passes through silently.

Expected Behavior

The SAP adapter implements the same contract: J = [1, -deriv] with deriv = a1 + 2 a2 d + 3 a3 d^2 + 4 a4 d^3, g = q1 - q1_0 - poly(d), and d = 0 with the second column dropped when joint2 is absent. The build-time rejection introduced in #3290 goes away with it, and tests/coupling/test_hybrid.py gets the scaled polynomial scene of tests/rigid/test_constraints.py::test_equality_joint_scaling under SAP.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions