Ignore geoms with tiny mass in inertiafromgeom computation. Fixes #2754

PiperOrigin-RevId: 795475978
Change-Id: I02b5db9e2ac7ec556cb0a0ec6dbe4214ba9128d7
This commit is contained in:
Yuval Tassa
2025-08-15 07:56:14 -07:00
committed by Copybara-Service
parent 977f94e9df
commit b566ef2883
2 changed files with 65 additions and 53 deletions
+3 -2
View File
@@ -1902,11 +1902,12 @@ void mjCBody::InertiaFromGeom(void) {
double toti[6] = {0, 0, 0, 0, 0, 0};
std::vector<mjCGeom*> sel;
// select geoms based on group
// select geoms based on group, ignore tiny masses
sel.clear();
for (int i=0; i < geoms.size(); i++) {
if (geoms[i]->group >= compiler->inertiagrouprange[0] &&
geoms[i]->group <= compiler->inertiagrouprange[1]) {
geoms[i]->group <= compiler->inertiagrouprange[1] &&
geoms[i]->mass_ > mjEPS) {
sel.push_back(geoms[i]);
}
}