stack-of-tasks / pinocchio

A fast and flexible implementation of Rigid Body Dynamics algorithms and their analytical derivatives
http://stack-of-tasks.github.io/pinocchio/
BSD 2-Clause "Simplified" License
1.89k stars 392 forks source link

Fixed joint in URDF seems being merged when loading model #1638

Closed DavidYaonanZhu closed 2 years ago

DavidYaonanZhu commented 2 years ago

Fixed joint in URDF seems to be merged when loading model.

I loaded a tiago dual arm robot URDF,

model = pinocchio.buildModelFromUrdf(self.urdf_filename) then, model.njoints it gives 34, however If I, model.getJointId("arm_left_tool_joint")

some of the joints give the same ID.

In addition, does this library support Jacobian acquisition of different base_link and tool_link, like KDL?

jcarpent commented 2 years ago

Could you provide a full example? I will provide a complete answer then

De: "DavidYaonanZhu" @.> À: "stack-of-tasks" @.> Cc: "Subscribed" @.***> Envoyé: Mardi 26 Avril 2022 08:45:02 Objet: [stack-of-tasks/pinocchio] Fixed joint in URDF seems being merged when loading model (Issue #1638)

Fixed joint in URDF seems to be merged when loading model.

I loaded a tiago dual arm robot URDF,

model = pinocchio.buildModelFromUrdf(self.urdf_filename) then, model.njoints it gives 34, however If I, model.getJointId("arm_left_tool_joint")

some of the joints give the same ID.

In addition, does this library support Jacobian acquisition of different base_link and tool_link, like KDL?

— Reply to this email directly, [ https://github.com/stack-of-tasks/pinocchio/issues/1638 | view it on GitHub ] , or [ https://github.com/notifications/unsubscribe-auth/AAL6UVKIVQYGM4QKALEYHDTVG6GG5ANCNFSM5UKYVJIA | unsubscribe ] . You are receiving this because you are subscribed to this thread. Message ID: @.***>

jcarpent commented 2 years ago

In addition, does this library support Jacobian acquisition of different base_link and tool_link, like KDL?

I don't the API of KDL, but for sure, you can retrieve the Jacobian of any link with Pinocchio.

DavidYaonanZhu commented 2 years ago

https://github.com/stack-of-tasks/pinocchio/issues/1638#issuecomment-1109464867

How to do that? can you give me some examples?

suppose the urdf is base_link - torso_link- arm_link1 - arm_link2 For example, I want to get jacobian from base_link to arm_link2, and also torso_link to arm_link1 how to do that?

with normal model loading it assumes the starting link of the jacobian is base_link, but how to change that starting link?

jcarpent commented 2 years ago

There is not direct tool in Pinocchio which allows that, but you can do that indirectly. Could you give the name of such a tool in KDL?

We will try to add it to the main API ;)

DavidYaonanZhu commented 2 years ago

Yes, can you give some hints on how to do that indirectly?

DavidYaonanZhu commented 2 years ago

I will update information of KDL tool shortly

jcarpent commented 2 years ago

You just need to collect the column indexes which are related to the joints supporting the path between the two links in questions For a given joint, you can retrieve its starting index and the size of the motion subspace by using model.joints[joint_id].idx_v, model.joints[joint_id].nv