Add per-body gravity compensation (buoyancy) passive force.

PiperOrigin-RevId: 485342531
Change-Id: Icb3e6bb5080b6ef17a3d3b1cc67e0503cfeaeffb
This commit is contained in:
Kyle Bayes
2022-11-01 09:47:13 -07:00
committed by Copybara-Service
parent c7960385be
commit 23092a11d7
18 changed files with 233 additions and 10 deletions
+1
View File
@@ -1285,6 +1285,7 @@ void mjCModel::CopyTree(mjModel* m) {
copyvec(m->body_iquat+4*i, pb->lociquat, 4);
m->body_mass[i] = (mjtNum)pb->mass;
copyvec(m->body_inertia+3*i, pb->inertia, 3);
m->body_gravcomp[i] = pb->gravcomp;
copyvec(m->body_user+nuser_body*i, pb->userdata.data(), nuser_body);
// count free joints
+1
View File
@@ -326,6 +326,7 @@ mjCBody::mjCBody(mjCModel* _model) {
weldid = -1;
dofnum = 0;
lastdof = -1;
gravcomp = 0;
userdata.clear();
// plugin variables
+1
View File
@@ -186,6 +186,7 @@ class mjCBody : public mjCBase {
double iquat[4]; // inertial frame orientation
double mass; // mass
double inertia[3]; // diagonal inertia (in i-frame)
double gravcomp; // gravity compensation
std::vector<double> userdata; // user data
mjCAlternative alt; // alternative orientation specification
mjCAlternative ialt; // alternative for inertial frame