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
How to add weights to the coordinates of a model using C++ API
- Vincent Fohanno
- Posts: 23
- Joined: Thu May 10, 2018 10:03 am
- Thomas Uchida
- Posts: 1793
- Joined: Wed May 16, 2012 11:40 am
Re: How to add weights to the coordinates of a model using C++ API
The Coordinates are handled by the AssemblySolver class (parent to InverseKinematicsSolver), which may provide the functionality you're looking for.
- 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
Thanks Thomas. I will look into it
- 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
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
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
- Thomas Uchida
- Posts: 1793
- Joined: Wed May 16, 2012 11:40 am
Re: How to add weights to the coordinates of a model using C++ API
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).
- 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
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
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