Add mjModel.ngravcomp, number of bodies with nonzero gravcomp attribute.

PiperOrigin-RevId: 627087335
Change-Id: Ie85ae4150962463b8a8c8435fec068c44877aa16
This commit is contained in:
Yuval Tassa
2024-04-22 10:44:33 -07:00
committed by Copybara-Service
parent 546a27ca72
commit 8ebc9ed2c8
8 changed files with 37 additions and 22 deletions
+7
View File
@@ -2105,6 +2105,13 @@ void mjCModel::CopyTree(mjModel* m) {
}
}
// count bodies with gravity compensation, compute ngravcomp
int ngravcomp = 0;
for (int i=0; i<nbody; i++) {
ngravcomp += (m->body_gravcomp[i] > 0);
}
m->ngravcomp = ngravcomp;
// compute nM and dof_Madr
nM = 0;
for (int i=0; i<nv; i++) {