Closed mj-hwang closed 6 days ago
I think you are correct. I just checked and it seems this error didn't surface up before because we often controlled invisible links (marked as the TCP) which is connected via a fixed joint to an actual link.
Happy to accept a PR! Otherwise I'll merge a fix for this in a few days
Hello everyone! I was wondering if the current implementation of
active_ancestor_joints
is correct.In the
mani_skill.agents.controllers.utils.kinematics.py
,active_ancestor_joints
are computed by iterating through the parent link/join until thecur_link
is None, wherecur_link
initialized with the joint of the parent link (see line 54 of kinematics.py:cur_link = self.end_link.joint.parent_link
):I believe this initialization is incorrect since it should really start from the
end_link
, not its parent link. The current implementation works fine in case theend_link
is not directly connected with one of the active joints (which is the case for most robot arms with end effectors).However, say we are controlling a Franka robot, and we want to use
panda_link7
as the end link. With the current implementation,panda_joint7
gets ignored since it starts from the joint of the end link's parent link. In fact, if you setee_link_name
in panda aspanda_link7
, the kinematics class gives an error because of this issue because of the mismatch betweenself.active_joint_indices
(i.e. 0-6 for 7 joints) andself.active_ancestor_joint_idxs
(i.e. 0-5 for 6 joints since joint 7 is ignored). :Here, 6 is not in the list of [0,1,2,3,4,5] (active_ancestor_joint_idxs), which is missing the joint 7.
This can be simply fixed by just replacing the line 54 with
cur_link = self.end_link
. That is, we just start iterating from the end link not its parent link :)).I apologize if my explanation wasn't clear. Let me know if this is a desired behavior, or if we should apply the suggested fix.