Warn when a non-rigid flex has no constraints or passive forces.

Add a warning in user_model.cc if a flex is not rigid and has no edge equality constraints or passive forces (edge stiffness, edge damping, or vertex damping). Such flexes would not affect the simulation. A test case is added to verify the warning.

PiperOrigin-RevId: 889215981
Change-Id: I481128e1456921b632719547c676d201fdfbe931
This commit is contained in:
Alessio Quaglino
2026-03-25 06:49:43 -07:00
committed by Copybara-Service
parent fd3ce4fe92
commit c49bc7c7c0
2 changed files with 23 additions and 0 deletions
+6
View File
@@ -3538,6 +3538,12 @@ void mjCModel::CopyObjects(mjModel* m) {
}
}
if (!pfl->rigid && m->flex_edgeequality[i] == 0 &&
!pfl->edgestiffness && !pfl->edgedamping && !pfl->damping) {
mju_warning("flex '%s' is not rigid and has no equality constraints "
"or passive forces", pfl->name.c_str());
}
// copy bvh data (flex aabb computed dynamically in mjData)
if (pfl->tree.Nbvh()) {
memcpy(m->bvh_child + 2*bvh_adr, pfl->tree.Child().data(), 2*pfl->tree.Nbvh()*sizeof(int));