Disallow using elasticity and edge constraints at the same time.

Fixes #2084.

PiperOrigin-RevId: 678614880
Change-Id: I44eead3dc4edf82d725a3063b927a421c660721a
This commit is contained in:
Alessio Quaglino
2024-09-25 02:55:05 -07:00
committed by Copybara-Service
parent 2785dbc0da
commit 1eb6fc2285
2 changed files with 8 additions and 0 deletions
+3
View File
@@ -2896,6 +2896,9 @@ void mjCFlex::Compile(const mjVFS* vfs) {
// compute elasticity
if (young > 0) {
if (poisson < 0 || poisson >= 0.5) {
throw mjCError(this, "Poisson ratio must be in [0, 0.5)");
}
stiffness.assign(21*nelem, 0);
for (unsigned int t = 0; t < nelem; t++) {
if (dim==2) {
+5
View File
@@ -2694,6 +2694,11 @@ void mjXReader::OneFlexcomp(XMLElement* elem, mjsBody* body, const mjVFS* vfs) {
ReadAttr(elasticity, "thickness", 1, &dflex.thickness, text);
}
// check errors
if (elasticity && fcomp.equality) {
throw mjXError(elem, "elasticity and edge constraints cannot both be present");
}
// contact
XMLElement* cont = FirstChildElement(elem, "contact");
if (cont) {