OpenSim v.2.3.1

Provide easy-to-use, extensible software for modeling, simulating, controlling, and analyzing the neuromusculoskeletal system.
User avatar
sariah Mghames
Posts: 23
Joined: Thu Jun 30, 2016 5:56 am

OpenSim v.2.3.1

Post by sariah Mghames » Tue Jul 26, 2016 5:34 am

Dear OpenSim Team,

I am trying to import OpenSim libraries to simulink where I have the OpenSimSFunction. The SFunction that i have access to is of version 2.3.1 and 1.9.1. But for that to work I need to download OpenSim 2.3.1 or 1.9.1 instead opensim 3.3

I have found the installation of opensim 1.9.1 but not that of 2.3.1 , Is there any proper link to download OpenSim 2.3.1 ?

Thanks in advance
Sariah Mghames

User avatar
jimmy d
Posts: 1375
Joined: Thu Oct 04, 2007 11:51 pm

Re: OpenSim v.2.3.1

Post by jimmy d » Tue Jul 26, 2016 11:33 am

Hi Sarah,

There is no OpenSim 2.3.1. The releases went from 2.2.1 to 2.4.

Did you mean 2.2.1?

-James

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

Re: OpenSim v.2.3.1

Post by Ayman Habib » Tue Jul 26, 2016 12:00 pm

Hi Sarah,

Version 2.3.1 was never officially released, it was used for development and in a couple workshops leading to version 2.4. Very likely if you download version 2.4 you can get away with it, but there're some catches that you need to be aware of:
1. There's a difference between the code compiling and running successfully as bug fixes and changes in implementation may have caused behavior to change.
2. Version 2.4 was built using the compilers available at the time (2011) since then these compilers were retired and while there's a chance that libraries built then still work with current compilers there's no guarantee.
3. You'll be missing on years of development and bug-fixes that went into OpenSim versions up to 3.3 but I don't know if that affects the functionality you're using.

My suggestion would be to try version 2.4, see if it works out of the box, if not get the code authors to migrate to version 3.3 so that we can support you and them better moving forward.

Best of luck,
-Ayman

User avatar
Deepak Jindal
Posts: 14
Joined: Sun Jun 05, 2016 11:04 pm

Re: OpenSim v.2.3.1

Post by Deepak Jindal » Thu Jul 28, 2016 10:51 pm

Is there any proper link to download opensim version 2.4...??? or any 2+version ???

User avatar
sariah Mghames
Posts: 23
Joined: Thu Jun 30, 2016 5:56 am

Re: OpenSim v.2.3.1

Post by sariah Mghames » Mon Aug 01, 2016 7:26 am

Thank you Ayman,

Yes I got the version OpenSim 2.4 and the simulator opens successfully independent from Matlab.

The only problem that I have is when I run the SFunction in simulink ( after getting the mex file out of Sfunction.cpp compilation). The Matlab used has version 32 bits ( tried on 2015b , 2012b , 2010a).

The error coming from running simulink S-function block is in fact related to mex file at the command line of S-function.cpp source code :
model = new Model(modelFileName); // Note: MATLAB crashes without setting path to OpenSim DLL's

error1 after running S-function block in simulink:
Unexpected Standard exception from MEX file.
What() is:XMLDocument.XMLDocument: ERROR- SAX exception while attempting to
parse arm26.osim

error2: Error while obtaining sizes from MEX S-function 'openSimSFunction'

In my case opensim DLL's are added to the path, but now after you told me previously that opensim 2.4 was built using the compilers available at the time (2011) , I want to ask you if you know the source of my error : I am using visual studio 2008 with Matlab 32 bits ( my error is related to mex compiler but I am not able to figure out the origin of the matlab error),

I will be grateful if you can help in a way,

User avatar
Dimitar Stanev
Posts: 1096
Joined: Fri Jan 31, 2014 5:14 am

Re: OpenSim v.2.3.1

Post by Dimitar Stanev » Mon Aug 01, 2016 11:32 pm

Hi,

Can you open the .osim file successfully in the GUI? It is possible that the model is not compatible with 2.4.

Best

User avatar
sariah Mghames
Posts: 23
Joined: Thu Jun 30, 2016 5:56 am

Re: OpenSim v.2.3.1

Post by sariah Mghames » Tue Aug 02, 2016 1:37 am

Hi Jim,

Yes you're right,
I tried to open .osim in GUI Opensim 2.4 and I had similar error:

Could not construct a model from arm26.osim
Details:
XMLDocument.XMLDocument: ERROR- SAX exception while attempting to parse arm26.osim
SAXException message = The XML or Text declaration must start at line/column 1/1

I am not sure if this error is related to compatibility, however this arm26.osim is included in the examples folder for the compilation of S-Function v.2.3.1 in simulink
But since there is no more Opensim 2.3.1 to download and there is only S-function libraries v.2.3.1 and 1.9.1 (32 bits), I used the s-function v.2.3.1 but downloaded Opensim 2.4 ... I am not sure If an alternative to solve my problem can be to bring the arm26.osim in the installation directory of opensim v.2.4 to the compilation folder of S-function v.2.3.1

Any possible alternative you can suggest will be much appreciated ,
Thank you,

User avatar
Dimitar Stanev
Posts: 1096
Joined: Fri Jan 31, 2014 5:14 am

Re: OpenSim v.2.3.1

Post by Dimitar Stanev » Tue Aug 02, 2016 1:42 am

From the error it is not clear. You must start to remove/add parts of the .osim iteratively till you find the cause of the problem.

User avatar
sariah Mghames
Posts: 23
Joined: Thu Jun 30, 2016 5:56 am

Re: OpenSim v.2.3.1

Post by sariah Mghames » Tue Aug 02, 2016 2:13 am

Hello,

I tried replacing xml files (.osim xml and controls.xml) of opensim 2.4 in the files folder of S-Function compilation v.2.3.1 and the problem was solved,

Thanks Jim for pointing me out the issue

User avatar
sariah Mghames
Posts: 23
Joined: Thu Jun 30, 2016 5:56 am

Re: OpenSim v.2.3.1

Post by sariah Mghames » Wed Aug 17, 2016 6:31 pm

Hello again,

After Importing OpenSim 2.4 libraries to matlab, I run some scripts and I got an output state vector for the opensim model arm26
The output state vector is 16x1 composed of elbow flexion, shoulder elevation, the derivatives of the previous 2 states and other auxiliary states related to muscles activation and fiber length

However I am in need of getting directly joint torque as output state in addition to the previously stated states without passing through the inverse muscles dynamics( to get torques from joint position output state)

I searched the header files of opensim libraries to see where the names of the output states are listed and trying to figure out if I can modify something to get torque as output state also. So :

Starting from header file Model.h, Line 613, the function getStateNames() is defined to be:
virtual void OpenSim::Model::getStateNames ( Array< std::string > & rStateNames,bool includeInternalStates = false)
where rStateNames are "the continuous states introduced by OpenSim ModelComponents and exposed thru the ModelComponent API. Other internal SimTK states may exist, but we have no way to name them or access them otherwise"

Then I opened the header file ModelComponent.h , Line 193 , the function getStateVariableName() is defined to be:
virtual std::string getStateVariableName(int index) const
{
throw Exception("This ModelComponent has no state variables");
}

I am not able to find where the output state names that I got in matlab ( listed previously) are defined in OpenSim libraries. Do you have any idea in which header file or if I can retrieve joint torque in addition to position by modifying maybe some commands in the Opensim libraries ?

Thanks in advance for any help you can provide

Sariah,

POST REPLY