# How to calculate Jacobian

Hello,

I am a working with a UR5 arm and I am trying to calculate the Jacobian from the joints of the arm.

I understand that the MoveIt framework provides a function to get the Jacobian; however, I need to figure out how to code it in C++ for the project.

I am following this tutorial: http://wiki.ros.org/pr2_mechanism/Tut...

And I'm having trouble getting the "chain_" since because for some reason, I am not able to import the pr2_mechanism_model packages.

I was wondering if someone could tell me how to define "chain_" and (if possible) tell me the steps to calculate the Jacobian.

Thank you in advance

Post the errors you are having when you try to import the

`pr2_mechanism_model`

packages.I'm guessing this tutorial is a much-more recent tutorial that includes a section on how to compute the Jacobian

So if you use the MoveIt! libraries, you could compute the Jacobian that way. If you want to avoid MoveIt! entirely, you could use something like

`kdl_parser`

to convert the URDF to a KDL "chain", and then use KDL to compute Jacobian. You certainly shouldn't need the`pr2_mechanism_model`

packages http://wiki.ros.org/kdl_parser/Tutori...Hi everyone, thank you for your responses! I was able to figure it out!

It would be great if you could write an answer describing how you solved your problem so that future readers can benefit from your experiences. Plus, this question could then be marked as answered.