How to add weights to the coordinates of a model using C++ API

Provide easy-to-use, extensible software for modeling, simulating, controlling, and analyzing the neuromusculoskeletal system.
POST REPLY
User avatar
Vincent Fohanno
Posts: 23
Joined: Thu May 10, 2018 10:03 am

How to add weights to the coordinates of a model using C++ API

Post by Vincent Fohanno » Thu Sep 03, 2020 7:20 am

Hi,

I am using the C++ API to build and solve a model.
I would like to assign weights to the coordinates of my model.
I saw that it is possible when I look at the detailed description section of the InverseKinematicsSolver class (https://simtk.org/api_docs/opensim/api_ ... olver.html). I can see W_qj which contains the weights for the coordinates.

Unfortunately, I did not find a proper way to do it as compared with marker weights (there is a method to update the marker weights in the InverseKinematicsSolver class).
I found that one can create a CoordinateReference and set weights to it and include it as a third input argument of the InverseKinematicsSolver class (https://simtk.org/api_docs/opensim/api_ ... rence.html). However, one has to specify a Function for the desired value of this CoordinateReference which is not what I want because I do not know what the value should be (this is what I am trying to find actually by using the InverseKinematicsSolver class).

So I am a bit confused and any help to clarify how i can set weights to the coordinates of my model will be appreciated.

Thank you

Vincent

Tags:

User avatar
Thomas Uchida
Posts: 1777
Joined: Wed May 16, 2012 11:40 am

Re: How to add weights to the coordinates of a model using C++ API

Post by Thomas Uchida » Fri Sep 04, 2020 3:50 am

The Coordinates are handled by the AssemblySolver class (parent to InverseKinematicsSolver), which may provide the functionality you're looking for.

User avatar
Vincent Fohanno
Posts: 23
Joined: Thu May 10, 2018 10:03 am

Re: How to add weights to the coordinates of a model using C++ API

Post by Vincent Fohanno » Fri Sep 04, 2020 4:49 am

Thanks Thomas. I will look into it

User avatar
Vincent Fohanno
Posts: 23
Joined: Thu May 10, 2018 10:03 am

Re: How to add weights to the coordinates of a model using C++ API

Post by Vincent Fohanno » Fri Sep 04, 2020 6:32 am

Hi again,

I had a look at the AssemblySolver class but the problem remains the same.
I still cannot add only a weight to a Coordinate without giving a value to it.
This approach is therefore not appealing to me since the Coordinate values is what I am trying to get through the inverse kinematics process.
I would like to give a weight to each coordinate so it has more or less importance when the solver is trying to find a solution (minimising the error).
I really thought it was possible

Thanks anyway

Vincent

User avatar
Thomas Uchida
Posts: 1777
Joined: Wed May 16, 2012 11:40 am

Re: How to add weights to the coordinates of a model using C++ API

Post by Thomas Uchida » Fri Sep 04, 2020 6:06 pm

Please see the description of the algorithm on the "How Inverse Kinematics Works" page in the documentation (https://simtk-confluence.stanford.edu/d ... tics+Works). If the InverseKinematicsSolver class doesn't meet your specific needs, you could extend it (e.g., by creating a C++ plugin), or suggest an enhancement on the GitHub page (https://github.com/opensim-org/opensim-core/issues).

User avatar
Vincent Fohanno
Posts: 23
Joined: Thu May 10, 2018 10:03 am

Re: How to add weights to the coordinates of a model using C++ API

Post by Vincent Fohanno » Sun Sep 06, 2020 11:31 pm

Thank you Thomas.
This webpage has more information and explains the weights on the coordinates.
I was misled by the previous documentation page of the C++ API.
I understand now that this is doing something different from what I thought.
I will reflect and see if I want to investigate the other options you mentioned.

Regards

Vincent

POST REPLY