Muscle Origin and Insertion Coordinate Transformation
- Michael Asmussen
- Posts: 67
- Joined: Mon Jul 11, 2016 7:46 am
Re: Muscle Origin and Insertion Coordinate Transformation
Yes, it works. Thanks!
Also, is OpenSim 4.0 available for download?
Also, is OpenSim 4.0 available for download?
- Thomas Uchida
- Posts: 1804
- Joined: Wed May 16, 2012 11:40 am
Re: Muscle Origin and Insertion Coordinate Transformation
OpenSim 4.0 has not been officially released, but the code is available on GitHub: https://github.com/opensim-org/opensim-core.is OpenSim 4.0 available for download?
- Michael Asmussen
- Posts: 67
- Joined: Mon Jul 11, 2016 7:46 am
Re: Muscle Origin and Insertion Coordinate Transformation
Thank you!
Also, a few quick questions.
1. Is there a guide or tutorial on developing OpenSim scripting within Matlab aside from these references:
http://simtk-confluence.stanford.edu:80 ... g+Commands
https://simtk.org/api_docs/opensim/api_docs/index.html
2. Any ideas how to index the "Vec3" within Matlab? Or a general method for indexing the variables created with the OpenSim tools?
3. I assume the "model.getCoordinateSet().get('r_shoulder_elev')" followed by "shoulder.setValue(state, 0.1);" gets the coordinates for right shoulder elevation and sets it to 0.1 degrees? Is this correct? If so, is there a resource that describes the function of these tools used in Matlab in depth or is everything in the two resources mentioned above? I ask because, although I can understand what each line is likely performing, certain functions such as "getGroundBody" do not have a description (I believe) in the references above and this information might be important when developing my own scripts.
Thanks again!
Mike
Also, a few quick questions.
1. Is there a guide or tutorial on developing OpenSim scripting within Matlab aside from these references:
http://simtk-confluence.stanford.edu:80 ... g+Commands
https://simtk.org/api_docs/opensim/api_docs/index.html
2. Any ideas how to index the "Vec3" within Matlab? Or a general method for indexing the variables created with the OpenSim tools?
3. I assume the "model.getCoordinateSet().get('r_shoulder_elev')" followed by "shoulder.setValue(state, 0.1);" gets the coordinates for right shoulder elevation and sets it to 0.1 degrees? Is this correct? If so, is there a resource that describes the function of these tools used in Matlab in depth or is everything in the two resources mentioned above? I ask because, although I can understand what each line is likely performing, certain functions such as "getGroundBody" do not have a description (I believe) in the references above and this information might be important when developing my own scripts.
Thanks again!
Mike
- Thomas Uchida
- Posts: 1804
- Joined: Wed May 16, 2012 11:40 am
Re: Muscle Origin and Insertion Coordinate Transformation
Some resources in addition to the two links you mentioned:1. Is there a guide or tutorial on developing OpenSim scripting within Matlab aside from these references:
- the "Scripting with Matlab" page on Confluence: http://simtk-confluence.stanford.edu:80 ... ith+Matlab
- example scripts in your local OpenSim\Scripts\Matlab directory
- there's a MATLAB version of the dynamic walker example here: http://simtk-confluence.stanford.edu:80 ... nuary+2014 (direct link to the code: https://simtk.org/frs/download.php?file_id=3862).
- this Forum!
Additional documentation and examples for scripting will be accompanying the 4.0 release.
2. Any ideas how to index the "Vec3" within Matlab?
Code: Select all
>> import org.opensim.modeling.*;
>> a = Vec3(3.14)
a =
~[3.14,3.14,3.14]
>> a.set(0, 1.618);
>> a
a =
~[1.618,3.14,3.14]
>> a.get(0)
ans =
1.6180
It can vary depending on which class you're dealing with and what information you're trying to extract. The get…() methods are good places to start. The methodsview MATLAB function can also be helpful.Or a general method for indexing the variables created with the OpenSim tools?
Yes.3. I assume the "model.getCoordinateSet().get('r_shoulder_elev')" followed by "shoulder.setValue(state, 0.1);" gets the coordinates for right shoulder elevation and sets it to 0.1 degrees? Is this correct?
Many methods like get…() and set…() are not documented because they follow the standard naming conventions used throughout OpenSim (see the "Naming conventions" section of CONTRIBUTING.md on GitHub: https://github.com/opensim-org/opensim- ... onventions). Thus, getGroundBody() returns a reference to Ground, which is a Body that exists in every Model.If so, is there a resource that describes the function of these tools used in Matlab in depth or is everything in the two resources mentioned above? I ask because, although I can understand what each line is likely performing, certain functions such as "getGroundBody" do not have a description (I believe) in the references above and this information might be important when developing my own scripts.
- Michael Asmussen
- Posts: 67
- Joined: Mon Jul 11, 2016 7:46 am
Re: Muscle Origin and Insertion Coordinate Transformation
Thanks Tom!
Mike
Mike
- Michael Asmussen
- Posts: 67
- Joined: Mon Jul 11, 2016 7:46 am
Re: Muscle Origin and Insertion Coordinate Transformation
Thanks for the advice on indexing the Vec3. I have a follow up question about indexing a muscle name in Matlab and setting it as a string. Here is an example of what I have done
import org.opensim.modeling.*;
model = Model('C:\OpenSim 3.3\Models\Arm26\arm26.osim');
MuscleName=model.getMuscles().get(0)
MuscleName =
TRIlong
The format of MuscleName is a "1x1 Muscle". I was wondering if there is a method to index the MuscleName, in this example TRIlong, and set it as a string?
Thanks!
Mike
import org.opensim.modeling.*;
model = Model('C:\OpenSim 3.3\Models\Arm26\arm26.osim');
MuscleName=model.getMuscles().get(0)
MuscleName =
TRIlong
The format of MuscleName is a "1x1 Muscle". I was wondering if there is a method to index the MuscleName, in this example TRIlong, and set it as a string?
Thanks!
Mike
Re: Muscle Origin and Insertion Coordinate Transformation
MuscleName = char(model.getMuscles().get(0).getName())
- Michael Asmussen
- Posts: 67
- Joined: Mon Jul 11, 2016 7:46 am
Re: Muscle Origin and Insertion Coordinate Transformation
Thanks James! Much appreciated.
Mike
Mike
- Michael Asmussen
- Posts: 67
- Joined: Mon Jul 11, 2016 7:46 am
Re: Muscle Origin and Insertion Coordinate Transformation
After indexing the muscle names, I was wondering if there is a method to only index the muscles that contribute to a certain rotation? For example, index only the muscles that contribute to right ankle plantarflexion?
Also, once setting a model to a certain configuration in Matlab, is there a method to extract the moment arm for a muscle for all three degrees of freedom of a joint? Is there also a method to extract the muscle length for a given model configuration or does this have to be computed manually?
Thank you,
Mike
Also, once setting a model to a certain configuration in Matlab, is there a method to extract the moment arm for a muscle for all three degrees of freedom of a joint? Is there also a method to extract the muscle length for a given model configuration or does this have to be computed manually?
Thank you,
Mike
- Thomas Uchida
- Posts: 1804
- Joined: Wed May 16, 2012 11:40 am
Re: Muscle Origin and Insertion Coordinate Transformation
Not sure what you mean by "contribute". A muscle can accelerate joints it does not cross. Presumably, you want to collect only the muscles that generate an ankle plantarflexion moment. Even that takes some care since a muscle's path is a function of the pose. You could compute the moment arm for each muscle at a few poses and find the muscles whose moment arm is nonzero in at least one pose.I was wondering if there is a method to only index the muscles that contribute to a certain rotation? For example, index only the muscles that contribute to right ankle plantarflexion?
Have you tried the MomentArmSolver (https://simtk.org/api_docs/opensim/api_ ... olver.html)?is there a method to extract the moment arm for a muscle for all three degrees of freedom of a joint?
Fiber and tendon lengths are available through the MuscleAnalysis (https://simtk.org/api_docs/opensim/api_ ... lysis.html).Is there also a method to extract the muscle length for a given model configuration or does this have to be computed manually?