Introduces a new "strain" equality mode (flex_edgeequality = 3) for flexcomps with trilinear interpolation. This mode enforces constraints on the three invariants of the Green-Lagrange strain tensor at 8 Gauss quadrature points within each flex element, resulting in 24 equality constraints per flexcomp.

Also fixes a bug when attaching a flex with constraints.

PiperOrigin-RevId: 881349765
Change-Id: I8e6df8239488bfdc87d7e5b473568975e38c737e
This commit is contained in:
Alessio Quaglino
2026-03-10 04:25:19 -07:00
committed by Copybara-Service
parent fe6c81ed93
commit 713b5524bc
23 changed files with 899 additions and 48 deletions
+13
View File
@@ -2573,6 +2573,19 @@ void mj_rnePostConstraint(const mjModel* m, mjData* d) {
i += 2*m->flex_vertnum[k];
break;
case mjEQ_FLEXSTRAIN: {
// increment with 3 invariants × ngauss Gauss points
k = m->eq_obj1id[id];
int order = m->flex_interp[k];
int nodenum = m->flex_nodenum[k];
if (order && nodenum) {
int nquad = order + 1;
int ngauss = nquad * nquad * nquad;
i += 3 * ngauss;
}
break;
}
default:
mjERROR("unknown constraint type type %d", m->eq_type[id]); // SHOULD NOT OCCUR
}