Move fullinertia from mjCAlternative to mjCBody with correction to handle URDF with 0 inertias.

PiperOrigin-RevId: 604812870
Change-Id: I018254d1362a654a4f99bf5e621d5abc7129a0c6
This commit is contained in:
Matthew Bennice
2024-02-06 17:20:24 -08:00
committed by Copybara-Service
parent 19c41aa965
commit b9c50ad79c
10 changed files with 96 additions and 72 deletions
+6 -5
View File
@@ -51,14 +51,15 @@ void mjXBase::SetModel(mjCModel* _model) {
// read alternative orientation specification
void mjXBase::ReadAlternative(XMLElement* elem, mjmOrientation& alt) {
int mjXBase::ReadAlternative(XMLElement* elem, mjmOrientation& alt) {
string text;
int read = (int)(elem->Attribute("quat") != 0) +
(ReadAttr(elem, "axisangle", 4, alt.axisangle, text) ? 1 : 0) +
(ReadAttr(elem, "xyaxes", 6, alt.xyaxes, text) ? 1 : 0) +
(ReadAttr(elem, "zaxis", 3, alt.zaxis, text) ? 1 : 0) +
(ReadAttr(elem, "euler", 3, alt.euler, text) ? 1 : 0) +
(ReadAttr(elem, "fullinertia", 6, alt.fullinertia, text) ? 1 : 0);
if (read > 1)
throw mjXError(elem, "multiple orientation specifiers for the same field are not allowed");
(ReadAttr(elem, "euler", 3, alt.euler, text) ? 1 : 0);
if (read > 1) {
throw mjXError(elem, "multiple orientation specifiers are not allowed");
}
return read;
}