Support pinned flex vertices with bending
The flexcomp compiler previously rejected pins on dim-2 flexes with bending (elastic2d bend/both). Allow them: mj_flexPassiveBend treats a pinned vertex (body without 3 free slide dofs) as static -- zero velocity, and no bending force applied to it (the reaction is carried by the pin) -- while its position still enters every neighbor's bending force, which is exactly what the pin constrains. PiperOrigin-RevId: 944410969 Change-Id: Ib0a69c8d5fb6f64d3e2a76af3b6b2c7be1898191
This commit is contained in:
committed by
Copybara-Service
parent
c4c2cad503
commit
fb6d1cf18f
@@ -4280,10 +4280,16 @@ void mjCFlex::ResolveReferences(const mjCModel* m) {
|
||||
mjCBody* pbody = static_cast<mjCBody*>(m->FindObject(mjOBJ_BODY, vertbody));
|
||||
if (pbody) {
|
||||
vertbodyid.push_back(pbody->id);
|
||||
if (pbody->joints.size() != 3 && dim == 2 &&
|
||||
// pinned vertices with bending are only valid for static (jointless) pin
|
||||
// bodies: the runtime treats pin velocity as zero, which is only correct
|
||||
// for static bodies.
|
||||
if (!pbody->joints.empty() && pbody->joints.size() != 3 && dim == 2 &&
|
||||
(elastic2d == 1 || elastic2d == 3) && !interpolated) {
|
||||
// TODO(quaglino): add support for pins
|
||||
throw mjCError(this, "pins are not supported for bending");
|
||||
throw mjCError(
|
||||
this,
|
||||
"pinned flex vertices with bending require a static (jointless) "
|
||||
"pin body, body '%s' has joints",
|
||||
vertbody.c_str());
|
||||
}
|
||||
} else {
|
||||
throw mjCError(this, "unknown body '%s' in flex", vertbody.c_str());
|
||||
|
||||
Reference in New Issue
Block a user