Repository navigation
What's new in v4.6.0
✨ MJCF ball joints
The MJCF parser no longer treats ball joints as fixed. A ball joint shoulder becomes three revolute links shoulder_x, shoulder_y and shoulder_z, rotating around the X, Y and Z axes of the joint frame in that order (Rx @ Ry @ Rz). Each angle is bounded by the joint's range (MuJoCo's limit on the total rotation angle, now converted from degrees), or unbounded without one.
ikpy.mjcf.utils.ball_joint_angles_to_quat and ikpy.mjcf.utils.quat_to_ball_joint_angles convert the three angles to and from the (w, x, y, z) quaternion of the joint in MuJoCo's qpos:
from ikpy.mjcf import utils as mjcf_utils
angles = chain.inverse_kinematics(target_position)
i = [link.name for link in chain.links].index("shoulder_x")
quat = mjcf_utils.ball_joint_angles_to_quat(angles[i:i + 3]) # (w, x, y, z), as in qposfree joints are still treated as fixed.
Thanks to @physicalfleet-dev-team for this feature (#206).
🐛 MJCF joints rotate around their anchor
The anchor of a MJCF joint (pos) was added to the link origin but never subtracted for the child body, so every child was shifted by pos (and the anchor was taken in the parent frame instead of the body frame). Joints now rotate their body around the anchor without moving the body frame, like MuJoCo: on a test arm, the tip was 6 to 16 cm off before. When the chain ends in a body whose joint has an anchor, a fixed link <body>_frame brings it back to the body frame. Models whose joints sit at the body origin are unchanged (#207).
Both changes were checked against MuJoCo 4.1 mj_kinematics to 1e-15.
Full Changelog: v4.5.1...v4.6.0