ami-iit / adam

adam implements a collection of algorithms for calculating rigid-body dynamics in Jax, CasADi, PyTorch, and Numpy.
https://adam-docs.readthedocs.io/en/latest/
BSD 3-Clause "New" or "Revised" License
123 stars 19 forks source link

jacobian of manipulator with fixed base #96

Open AlessiaFusco99 opened 2 weeks ago

AlessiaFusco99 commented 2 weeks ago

Hi, I am trying to use the jacobian_fun on an arm with seven degrees of freedom. As the manipulator has a fixed base the jacobian should have a dimension of 6x7 but I obtained a 6x13 matrix, could you suggest to me how I can fix the issue? This is the code I am currently using. Thank you.


import casadi as cs
from adam.casadi import KinDynComputations
import numpy as np

file_id = "human_arm.urdf"
root_link = "RightUpperArm_f1"
joints_names_list = ["jRightShoulder_rotx", "jRightShoulder_roty",
                     "jRightShoulder_rotz", "jRightElbow_rotx",
                     "jRightWrist_rotx", "jRightWrist_roty", "jRightWrist_rotz"]
kindyn = KinDynComputations(urdfstring=file_id, joints_name_list=joints_names_list, root_link=root_link)
frame = 'RightHand'
base_transform = np.eye(4)
J_fun = kindyn.jacobian_fun(frame)
q = [cs.SX.sym(f'q{i+1}') for i in range(7)]  # joint angles
J = J_fun( base_transform, cs.vertcat(*q[6:]))
traversaro commented 2 weeks ago

You can just drop the first six columns, see https://github.com/ami-iit/adam/issues/77#issuecomment-2100398149 for more details on this.