Set default body position to (0, 0, 0).

The "undefined" body position is a remnant of the now-removed `compiler/coordinate` attribute, see [documentation in version 2.3.3](https://mujoco.readthedocs.io/en/2.3.3/modeling.html#cframe) (or older).

PiperOrigin-RevId: 676361485
Change-Id: I104c8da2a988a0430eb85fff8b9b60f8c1e08582
This commit is contained in:
Yuval Tassa
2024-09-19 04:35:34 -07:00
committed by Copybara-Service
parent 3839ad186e
commit f161b63a22
2 changed files with 1 additions and 18 deletions
-1
View File
@@ -78,7 +78,6 @@ void mjs_defaultBody(mjsBody* body) {
memset(body, 0, sizeof(mjsBody));
// body frame
body->pos[0] = mjNAN;
body->quat[0] = 1;
// inertial frame
+1 -17
View File
@@ -1482,11 +1482,6 @@ void mjCBody::Compile(void) {
}
userdata_.resize(model->nuser_body);
// pos defaults to (0,0,0)
if (!mjuu_defined(pos[0])) {
mjuu_setvec(pos, 0, 0, 0);
}
// normalize user-defined quaternions
mjuu_normvec(quat, 4);
mjuu_normvec(iquat, 4);
@@ -1524,23 +1519,12 @@ void mjCBody::Compile(void) {
InertiaFromGeom();
}
// both pos and ipos undefined: error
if (!mjuu_defined(ipos[0]) && !mjuu_defined(pos[0])) {
throw mjCError(this, "body pos and ipos are both undefined");
}
// ipos undefined: copy body frame into inertial
else if (!mjuu_defined(ipos[0])) {
if (!mjuu_defined(ipos[0])) {
mjuu_copyvec(ipos, pos, 3);
mjuu_copyvec(iquat, quat, 4);
}
// pos undefined: copy inertial frame into body frame
else if (!mjuu_defined(pos[0])) {
mjuu_copyvec(pos, ipos, 3);
mjuu_copyvec(quat, iquat, 4);
}
// check and correct mass and inertia
if (id>0) {
// fix minimum