Improving moment arm calculation speed

Provide easy-to-use, extensible software for modeling, simulating, controlling, and analyzing the neuromusculoskeletal system.
POST REPLY
User avatar
Marc Carmichael
Posts: 45
Joined: Thu Jul 16, 2009 2:50 am

Improving moment arm calculation speed

Post by Marc Carmichael » Thu Nov 25, 2010 4:49 pm

Hi,

A part of my work involves mapping muscle moment arm data to model pose. I use the computeMomentArm() function through the API to do this, but it takes quite a while to compute for every muscle in a large model.

I was wondering if some one could explain how this function works to compute the moment arms, and if there has been any progress or new techniques that can make this faster while achieving results with similar accuracy?

Thanks

Marc

User avatar
Ayman Habib
Posts: 2235
Joined: Fri Apr 01, 2005 12:24 pm

RE: Improving moment arm calculation speed

Post by Ayman Habib » Sun Nov 28, 2010 10:12 am

Hi Marc,

What version of OpenSim are you using? Version 2.2 contains a new method that should produce the same results but solves for the moment arm analytically (vs. numerically by perturbing coordinates and measuring length in previous versions) so it should be really fast. If using the API (again in version 2.2) you can use the MomentArmSolver to compute the moment arms for several muscles simultaneously.

Good luck and please let me know if you have any questions,
-Ayman

User avatar
Marc Carmichael
Posts: 45
Joined: Thu Jul 16, 2009 2:50 am

RE: Improving moment arm calculation speed

Post by Marc Carmichael » Sun Nov 28, 2010 8:36 pm

Hi Ayman,

I was using version 2.0, but what you describe in 2.2 sounds exactly what I am after.

I downloaded the Linux 2.2.0 version but it does not include the MomentArmSolver.h header file. Has this functionality been included in the linux version libraries? If so should copying the header files from the Windows version work?

Cheers

Marc

User avatar
Ayman Habib
Posts: 2235
Joined: Fri Apr 01, 2005 12:24 pm

RE: Improving moment arm calculation speed

Post by Ayman Habib » Mon Nov 29, 2010 2:08 am

Hi Marc,

The header and libraries go together. The header is located in
opensim220-linux32-API.tar\OpenSimInstall\sdk\include\OpenSim\Simulation\MomentArmSolver.h

in the linux distribution posted under release betas. Please give it a spin and let me know how it goes.

Good luck,
-Ayman

User avatar
Ayman Habib
Posts: 2235
Joined: Fri Apr 01, 2005 12:24 pm

RE: Improving moment arm calculation speed

Post by Ayman Habib » Mon Nov 29, 2010 4:58 pm

Hi Marc,

I updated the Linux distribution on the downloads page as I found out that the older tar file was missing a dependent library, please give the new distribution a shot and let me know how it goes.

Thanks,
-Ayman

User avatar
Marc Carmichael
Posts: 45
Joined: Thu Jul 16, 2009 2:50 am

RE: Improving moment arm calculation speed

Post by Marc Carmichael » Mon Nov 29, 2010 6:13 pm

Thanks Ayman, I tried the new Linux distribution and it works fine.

I calculated the muscle moment-arm matrix for the upper limb model for 50 muscles over 7 joints. In version 2.0.2 it took 2110ms and in 2.2.0 it took only 1120ms. This is a significant decrease but I was still hoping it could be reduced more (we always want more :P ).

In 2.2.0 I compared using computeMomentArm() with using MomentArmSolver::solve() and found they both take the same time. Is this because computeMomentArm now utilizes the moment-arm solver?

Can you think of any other steps I could take to improve the speed of moment arm calculation? Perhaps using computeMomentArms() instead of computeMomentArm() ?

Thanks for you help

Marc

POST REPLY