Add dof="2d" option to flexcomp for in-plane deformations.

PiperOrigin-RevId: 902620719
Change-Id: Ib06d3f7b9439e1d90a8373a4289ade0c327e72e4
This commit is contained in:
Alessio Quaglino
2026-04-20 07:13:17 -07:00
committed by Copybara-Service
parent cad734ae70
commit 2d12dee025
6 changed files with 513 additions and 2 deletions
+11
View File
@@ -613,6 +613,17 @@ bool mjCFlexcomp::Make(mjsBody* body, char* error, int error_sz, const mjVFS* vf
}
}
// add two orthogonal sliders (x and y only)
else if (doftype == mjFCOMPDOF_2D) {
for (int j=0; j < 2; j++) {
mjsJoint* jnt = mjs_addJoint(pb, 0);
jnt->type = mjJNT_SLIDE;
mjuu_setvec(jnt->pos, 0, 0, 0);
mjuu_setvec(jnt->axis, 0, 0, 0);
jnt->axis[j] = 1;
}
}
// construct body name, add to vertbody
char txt[100];
mju::sprintf_arr(txt, "%s_%d", name.c_str(), i);
+1
View File
@@ -45,6 +45,7 @@ typedef enum _mjtDof {
mjFCOMPDOF_RADIAL,
mjFCOMPDOF_TRILINEAR,
mjFCOMPDOF_QUADRATIC,
mjFCOMPDOF_2D,
mjNFCOMPDOFS
} mjtDof;
+2 -1
View File
@@ -932,7 +932,8 @@ const mjMap fdof_map[mjNFCOMPDOFS] = {
{"full", mjFCOMPDOF_FULL},
{"radial", mjFCOMPDOF_RADIAL},
{"trilinear", mjFCOMPDOF_TRILINEAR},
{"quadratic", mjFCOMPDOF_QUADRATIC}
{"quadratic", mjFCOMPDOF_QUADRATIC},
{"2d", mjFCOMPDOF_2D}
};