Fix sign error in flex interp implicit integration.

The flex interp stiffness matrix is Negative Semi-Definite (NSD). When forming the RHS for implicit integration, the term involving the velocity and stiffness should be added, not subtracted. A new test is added to ensure energy stability for flex interp stretch stiffness with the implicitfast integrator.

PiperOrigin-RevId: 914845245
Change-Id: Iaaf0914909128e64e195f17cc5f2f344a8a43bc2
This commit is contained in:
Alessio Quaglino
2026-05-13 07:14:36 -07:00
committed by Copybara-Service
parent 69a1087e9e
commit 955ae3f3c0
3 changed files with 54 additions and 8 deletions
-4
View File
@@ -980,10 +980,6 @@ static void mjd_flexInterp_kernel(const mjModel* m, mjData* d, mjtFlexOp op,
int shell_mode = order < 0;
order = order < 0 ? -order : order;
// warn that bending derivatives are not yet implemented
if (shell_mode) {
mj_warning(d, mjWARN_INERTIA, f); // bending implicit derivatives missing
}
int cx = m->flex_cellnum[3*f+0];
int cy = m->flex_cellnum[3*f+1];
int cz = m->flex_cellnum[3*f+2];