Moment arm computation difference between 3.3 and 4.0

Provide easy-to-use, extensible software for modeling, simulating, controlling, and analyzing the neuromusculoskeletal system.
POST REPLY
User avatar
Kaiwen Yang
Posts: 45
Joined: Mon Sep 03, 2018 11:25 am

Moment arm computation difference between 3.3 and 4.0

Post by Kaiwen Yang » Thu Sep 10, 2020 7:29 pm

Hello all,

I was plotting gaslat140_r hip flexion moment arm as a function of hip flexion moment arm angle in both opensim 3.3 and opensim 4.0. Although both GUIs gives small near zero result, version 3.3 gives result on the order of 10^-17 while version 4.0 gives around 10^-4. The model I am using is https://simtk.org/projects/model-high-flex, similar thing happened with https://simtk.org/projects/full_body which gives a small const at order of 10^-5

I also built opensim from source and ran comuteMomenArm method in Matlab, C++ and they also gave me about -0.0004 instead of zero. What am I missing here? Can anyone explain to me why...?

Thanks,
Kaiwen
--------------------------------------------------------------------------------------------
here is part of the exported data from 4.0
UNKNOWN
version=1
nRows=100
nColumns=3
inDegrees=no
endheader
time /jointset/hip_r/hip_flexion_r/value gaslat140_r
0.00000000 -30.00000025 -0.00041034
1.00000000 -28.48484874 -0.00041034
2.00000000 -26.96969722 -0.00041034
3.00000000 -25.45454570 -0.00041034
4.00000000 -23.93939419 -0.00041034
5.00000000 -22.42424267 -0.00041034
6.00000000 -20.90909115 -0.00041034
7.00000000 -19.39393964 -0.00041034
8.00000000 -17.87878812 -0.00041034
9.00000000 -16.36363661 -0.00041034
10.00000000 -14.84848509 -0.00041034
11.00000000 -13.33333357 -0.00041034
12.00000000 -11.81818206 -0.00041034
13.00000000 -10.30303054 -0.00041034
14.00000000 -8.78787902 -0.00041034
15.00000000 -7.27272751 -0.00041034
16.00000000 -5.75757599 -0.00041034
-----------------------------------------------------------------------------------
Here is a part of exported data from 3.3
UNKNOWN
version=1
nRows=100
nColumns=3
inDegrees=no
endheader
time hip_flexion_r gaslat140_r
0.00000000 -30.00000025 0.00000000
1.00000000 -28.48484874 -0.00000000
2.00000000 -26.96969722 -0.00000000
3.00000000 -25.45454570 0.00000000
4.00000000 -23.93939419 0.00000000
5.00000000 -22.42424267 0.00000000
6.00000000 -20.90909115 -0.00000000
7.00000000 -19.39393964 -0.00000000
8.00000000 -17.87878812 0.00000000
9.00000000 -16.36363661 0.00000000
10.00000000 -14.84848509 0.00000000
11.00000000 -13.33333357 0.00000000
12.00000000 -11.81818206 0.00000000
13.00000000 -10.30303054 0.00000000

Tags:

User avatar
Carmichael Ong
Posts: 401
Joined: Fri Feb 24, 2012 11:50 am

Re: Moment arm computation difference between 3.3 and 4.0

Post by Carmichael Ong » Wed Sep 16, 2020 9:33 am

I agree that this is pretty odd. Would you be willing to share a short sample code that reproduces the problem (preferably in C++, but MATLAB is fine too)?

User avatar
Kaiwen Yang
Posts: 45
Joined: Mon Sep 03, 2018 11:25 am

Re: Moment arm computation difference between 3.3 and 4.0

Post by Kaiwen Yang » Wed Sep 16, 2020 5:09 pm

Hello Carmichael,

Here is the code:

Code: Select all

#include <OpenSim/OpenSim.h> 
#include <iostream>

using namespace std;
using namespace OpenSim;
using namespace SimTK;


void main() {
	ReferencePtr<Model> m_model;
	ReferencePtr<State> m_state;
	m_model = new Model("Rajagopal2015.osim");
	m_model->buildSystem();
	m_state = m_model->initializeState();
	m_model->getMultibodySystem().realize(*m_state, Stage::Velocity);
	double MA=m_model->getMuscles().get("gaslat_r").getGeometryPath().computeMomentArm(*m_state, m_model->getCoordinateSet().get("hip_flexion_r"));
	cout << MA << endl;
	cin.get();
	return;
}
returns -1.78156e-05

POST REPLY