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.7k stars 366 forks source link

How to get the axis of a revolute joint? #2195

Closed 2352878630 closed 3 months ago

2352878630 commented 3 months ago

I want to get a Vector3 type variable that represents the axis of a revolute joint. For example, in URDF file, I already have a joint with <axis xyz="1 0 0"/>. Now I want to get a variable with a value of 1 0 0 and a type of Vector3

Thank you very much !

jcarpent commented 3 months ago

Unfortunately, there is not yet a direct helper to extract it. Yet, you can recover this information partially as follows:

import pinocchio as pin
joint_model = pin.JointModelRX()
joint_data = joint_model.createData()
axis = joint_data.S[3:]

@jorisv Will you have time to add the getMotionAxis helper to all revolute and prismatic joints in Pinocchio and expose it to Python?