Hi Sepehr,
You can try using the MuscleAnalysis in the AnalyzeTool of OpenSim. With this you can calculate the moment arm of each muscle as a function of time (or of your movement). If you are interested in extracting the moment arm using the API, you can look at the following repository where I sample the moment arm at different poses and approximate it using polynomial fitting. There you can understand how to extract this information from OpenSim.
https://github.com/mitkof6/symbolic_moment_arm
How to get Moment Arm of a Body on Matlab ?
- Dimitar Stanev
- Posts: 1096
- Joined: Fri Jan 31, 2014 5:14 am
- Sepehr Ramezani
- Posts: 35
- Joined: Tue Nov 05, 2019 2:02 pm
Re: How to get Moment Arm of a Body on Matlab ?
Hi Dimitar,
Thank you so much,
I added following code to my "setup.xml" and got momentum arm:
Also I read your code at mentioned repository , it was brilliant idea to have momentum arm base on more than 1 coordinate.
Thank you so much,
I added following code to my "setup.xml" and got momentum arm:
Code: Select all
<AnalysisSet name="Analyses">
<objects>
<MuscleAnalysis name="MuscleAnalysis">
<on>true</on>
<start_time>0</start_time>
<end_time>10.619999999999999</end_time>
<step_interval>1</step_interval>
<in_degrees>true</in_degrees>
<muscle_list> all</muscle_list>
<moment_arm_coordinate_list> knee_angle_l</moment_arm_coordinate_list>
<compute_moments>true</compute_moments>
</MuscleAnalysis>
</objects>
<groups />
</AnalysisSet>
- Kristy Godoy
- Posts: 23
- Joined: Thu Feb 05, 2015 12:53 pm
Re: How to get Moment Arm of a Body on Matlab ?
Hello Sepehr,
Can you mention what files did you use as input for the moment arm calculation, please?
Thank you so much in advance.
Can you mention what files did you use as input for the moment arm calculation, please?
Thank you so much in advance.
- Michael Asmussen
- Posts: 67
- Joined: Mon Jul 11, 2016 7:46 am
Re: How to get Moment Arm of a Body on Matlab ?
If you wanted to complete this process in Matlab, an alternative method would be to:s.ramezani wrote: ↑Mon May 04, 2020 10:18 amYes, I want to calculate the moment arm of each desired muscle during movement. I mean after this calculation I should have a time-table with the first column of time, plus columns that represent momentum arm of each muscle. Also, I am trying to use a time step similar to the motion (IK.mot) time step.
Thank you.
1. extract each coordinate as a function time from the .mot file and define it as a matrix
2. get each coordinate from the model using "model.getCoordinateSet().get('INSERT COORDINATE NAME')"
3. Use a loop to cycle through each coordinate and each time point and set each coordinate to the value from your matrix you defined using "setValue"
4. Use the MomentArmSolver for each muscle, for each coordinate and for each point in time.
All the best,
Mike
- Ayman Habib
- Posts: 2248
- Joined: Fri Apr 01, 2005 12:24 pm
Re: How to get Moment Arm of a Body on Matlab ?
Thanks Michael,
I also want to mention that the GUI provides this functionality without any programming inside the plotter (if that fits your workflow or to verify your output).
- Load the model and motion.
- Open Plotter window
- Select Moment Arm for coordinate of choice in Y-Quantity
- Select Muscles
- Select the motion in X-Quantity
- Select "Add" to generate the plots
- Export data from plot to sto files.
Hope this helps,
-Ayman
I also want to mention that the GUI provides this functionality without any programming inside the plotter (if that fits your workflow or to verify your output).
- Load the model and motion.
- Open Plotter window
- Select Moment Arm for coordinate of choice in Y-Quantity
- Select Muscles
- Select the motion in X-Quantity
- Select "Add" to generate the plots
- Export data from plot to sto files.
Hope this helps,
-Ayman
Re: How to get Moment Arm of a Body on Matlab ?
Hi there,
I have the same goal to extract the moment arms over the time. But I don't get how to read them out after doint the MuscleAnalysis, i.e. how are these files then called? I see many fiber lengths and forces but no moment arms.
Thank you best in advance for the help.
I have the same goal to extract the moment arms over the time. But I don't get how to read them out after doint the MuscleAnalysis, i.e. how are these files then called? I see many fiber lengths and forces but no moment arms.
Thank you best in advance for the help.