-
-
Notifications
You must be signed in to change notification settings - Fork 88
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug Report] reset_mocap_welds doesn't work properly #213
Comments
Can you provide some sources about why it is wrong, it was changed in I can not find anything more in the docs: |
I'm not sure, but I believe it is related to this problem. case mjEQ_WELD: // fix relative position and orientation
// find global points
for (int j=0; j < 2; j++) {
mjtNum* anchor = data + 3*(1-j);
mju_rotVecMat(pos[j], anchor, d->xmat + 9*id[j]);
mju_addTo3(pos[j], d->xpos + 3*id[j]);
}
...
// compute orientation error: neg(q1) * q0 * relpose (axis components only)
mjtNum* relpose = data+6;
mju_mulQuat(quat, d->xquat+4*id[0], relpose); // quat = q0*relpose
mju_negQuat(quat1, d->xquat+4*id[1]); // quat1 = neg(q1)
mju_mulQuat(quat2, quat1, quat); // quat2 = neg(q1)*q0*relpose
mju_scl3(cpos+3, quat2+1, torquescale); // scale axis components by torquescale |
Unfortunately, I do not understand how mocap works Internally in MuJoCo Well enough to comment on it. Can you make an issue at DeepMind/MuJoCo? ( Also, please tag me.) |
For reference, this is how meta world Does things: https://github.com/Farama-Foundation/Metaworld/blob/c822f28f582ba1ad49eb5dcf61016566f28003ba/metaworld/envs/mujoco/sawyer_xyz/sawyer_xyz_env.py#L80 |
The standard in MuJoCo is defined here
I was also struggling with understanding how equality constraints are handled in MuJoCo. I found the xml reader to be a good source for understanding how they are constructed. Here is the relevant section for weld constraints: case mjEQ_WELD:
ReadAttrTxt(elem, "body1", name1, true);
ReadAttrTxt(elem, "body2", name2);
ReadAttr(elem, "relpose", 7, pequality->data+3, text);
ReadAttr(elem, "torquescale", 1, pequality->data+10, text);
if (!ReadAttr(elem, "anchor", 3, pequality->data, text)) {
mjuu_zerovec(pequality->data, 3);
}
break; So this basically tells us, that first comes the anchor (3 fields), then the relpose (7 fields, i.e. a position + quaternion, where as stated above the quaternion is of the form
They set eq_data to Does this clear things up, @Kallinteris-Andreas? |
@DavidPL1 Please make a PR, thanks! Also check the impact of the change on the fetch environments |
Describe the bug
The function
reset_mocap_welds
in mujoco_utils.py doesn't work properly.The issue appears to be related to Line 79:
It should be corrected to:
System Info
The text was updated successfully, but these errors were encountered: