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:
committed by
Copybara-Service
parent
3839ad186e
commit
f161b63a22
@@ -78,7 +78,6 @@ void mjs_defaultBody(mjsBody* body) {
|
|||||||
memset(body, 0, sizeof(mjsBody));
|
memset(body, 0, sizeof(mjsBody));
|
||||||
|
|
||||||
// body frame
|
// body frame
|
||||||
body->pos[0] = mjNAN;
|
|
||||||
body->quat[0] = 1;
|
body->quat[0] = 1;
|
||||||
|
|
||||||
// inertial frame
|
// inertial frame
|
||||||
|
|||||||
@@ -1482,11 +1482,6 @@ void mjCBody::Compile(void) {
|
|||||||
}
|
}
|
||||||
userdata_.resize(model->nuser_body);
|
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
|
// normalize user-defined quaternions
|
||||||
mjuu_normvec(quat, 4);
|
mjuu_normvec(quat, 4);
|
||||||
mjuu_normvec(iquat, 4);
|
mjuu_normvec(iquat, 4);
|
||||||
@@ -1524,23 +1519,12 @@ void mjCBody::Compile(void) {
|
|||||||
InertiaFromGeom();
|
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
|
// 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(ipos, pos, 3);
|
||||||
mjuu_copyvec(iquat, quat, 4);
|
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
|
// check and correct mass and inertia
|
||||||
if (id>0) {
|
if (id>0) {
|
||||||
// fix minimum
|
// fix minimum
|
||||||
|
|||||||
Reference in New Issue
Block a user