Hi everyone,

I have a problem when I use 'calcFrameJacobian()' to calculate the Jacobian matrix in MATLAB API. It seems that the coordinate indexes from the CoordinateSet are different from those of the SimbodyMatterSubsystem.

For example, I import a hand model with all fingers and calculate the Jacobian matrix according to the middle fingertip.
However, the columns in Jacobian that refer to the middle finger joints derived from CoordinateSet are all zeros and some other columns that refer to other fingers have values.

Jacobian matrix in which the columns are arranged finger by finger (columns 10,11,18,23 are for middle fingers )
Coordinate list derived from CoordinateSet in which the coordinates for the middle finger are 15-18.
I am wondering if this issue is due to the mismatch of the Coordinate index system of OpenSim and Simbody or something else.

Thanks for the help!

Best,

Junnan

## Jacobian matrix derived from SimbodyMatterSubsystem

- Carmichael Ong
**Posts:**387**Joined:**Fri Feb 24, 2012 11:50 am

### Re: Jacobian matrix derived from SimbodyMatterSubsystem

Check out `Model::getCoordinatesInMultibodyTreeOrder` (documentation, code) which could be helpful your use case.

This is used, for instance, in Inverse Dynamics: https://github.com/opensim-org/opensim- ... s.cpp#L169

This is used, for instance, in Inverse Dynamics: https://github.com/opensim-org/opensim- ... s.cpp#L169

### Re: Jacobian matrix derived from SimbodyMatterSubsystem

Great! this is exactly the function that i am looking for.

I have another problem regarding the coordinate setting. As I understand, once I create a joint to connect two adjacent bodies, I can define (or not define) the associated coordinates of that joint. The defined coordinates and their velocity compose a part of the State. Some of these coordinates can be prescribed as a function of another coordinate. The coordinates that are 'independent' are shown in the GUI window.

The problem I found in the model is that some of the coordinates are prescribed as a function of other independent coordinates and these dependent coordinates are not visualized in GUI and can not be given an arbitrary value.

I am wondering if my understanding is correct and how should I discover and deal with these dependent uncontrollable coordinates.

Thanks

I have another problem regarding the coordinate setting. As I understand, once I create a joint to connect two adjacent bodies, I can define (or not define) the associated coordinates of that joint. The defined coordinates and their velocity compose a part of the State. Some of these coordinates can be prescribed as a function of another coordinate. The coordinates that are 'independent' are shown in the GUI window.

The problem I found in the model is that some of the coordinates are prescribed as a function of other independent coordinates and these dependent coordinates are not visualized in GUI and can not be given an arbitrary value.

I am wondering if my understanding is correct and how should I discover and deal with these dependent uncontrollable coordinates.

Thanks