## Derivative of Jacobian

Questions about our Python API
Posts: 4
Joined: Fri Jul 15, 2022 3:49 am
Location: Pilani, Rajasthan

### Derivative of Jacobian

Hello!
I'm currently working with a Daisy Hexapod. I need to figure out a way to change the joint angles in order for the Jacobian matrix to behave a certain way.
For this I need a function that would output the derivative of the Jacobian Matrix with respect to the joint angles (6 by 3 by 3 matrix for one leg of the Daisy). I can realistically come up with this by getting the equation for the Jacobian as a symbolic function of the angles, and differentiating it to define the new function. Alternatively, I could also differentiate the Forward kinematics matrix twice and reach the same result.

However, I'm unable to find either of these matrices as symbolic functions within the documentation. If someone is aware of what either of these functions are, it would be very helpful. Alternatively, if someone knows how to differentiate the Jacobian matrix without worrying about the exact definition, it would also serve the same purpose. Thanks for your time matt_tesch
HEBI Official
Posts: 27
Joined: Mon Mar 30, 2020 9:14 am
Location: Pittsburgh, USA

### Re: Derivative of Jacobian

Hello,

The forward kinematics and jacobian are generated procedurally and numerically within the API, and so we do not have a symbolic function for either of these that we can expose. However, you should be able to numerically differentiate the Jacobian matrix or double-differentiate the forward kinematics. In these cases, you can perturb with a small joint angle perturbation dTheta around the current angle position, and use the resulting matrices to generate your numerical derivative. For example:

dJ(theta)/dTheta = (J(theta + dTheta) - J(theta)) / dTheta

Depending on your requirements, you can make this derivative unbiased by centering your Jacobian computations around theta instead of only adding to one side, which can make this more accurate. You can also numerically double-differentiate the forward kinematics directly by evaluating at theta, theta+dTheta, and theta-dTheta.

If it would help, we can provide some pseudocode for numerical differentiation of these matrices here as well.

Best,
Matt