Jacobian matrix derived from SimbodyMatterSubsystem

Provide easy-to-use, extensible software for modeling, simulating, controlling, and analyzing the neuromusculoskeletal system.
POST REPLY
User avatar
Junnan Li
Posts: 7
Joined: Thu Apr 22, 2021 3:38 am

Jacobian matrix derived from SimbodyMatterSubsystem

Post by Junnan Li » Tue May 28, 2024 7:17 am

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.
Capture.PNG
Capture.PNG (8.87 KiB) Viewed 1100 times
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 )
Jacobian.PNG
Jacobian.PNG (19.34 KiB) Viewed 1100 times
Coordinate list derived from CoordinateSet in which the coordinates for the middle finger are 15-18.
CoordinateSet.PNG
CoordinateSet.PNG (10.71 KiB) Viewed 1100 times
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

Tags:

User avatar
Carmichael Ong
Posts: 401
Joined: Fri Feb 24, 2012 11:50 am

Re: Jacobian matrix derived from SimbodyMatterSubsystem

Post by Carmichael Ong » Tue May 28, 2024 11:06 am

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

User avatar
Junnan Li
Posts: 7
Joined: Thu Apr 22, 2021 3:38 am

Re: Jacobian matrix derived from SimbodyMatterSubsystem

Post by Junnan Li » Wed May 29, 2024 2:48 am

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

POST REPLY