Use OpenSim 3.0 API into Octave on Windows

Posted by Stefano on Apr 29, 2013 in Uncategorized |

OpenSim 3.0 features well documented API integration with Matlab. I did some testing to see if the same mechanism can be used with the open source Octave Matlab clone and the fast answer is yes; this tests were performed under Windows 7 Ultimate.

Here are the bootstrap steps:

Download and install OpenSim 3.0 featuring Matlab integration from OpenSim download site

Tested with:
OpenSim-3.0.1-win32VC10P.exe (132550 kB) binary Windows Mar 27, 2013

Install OpenSim 3.0 in the default directory:
c:\OpenSim 3.0\

Install Octave3.6.4 for MinGW32
From Octave forge go to Windows Installers and download



Install Octave along with additional packages by following the guide:

From your installation folder:


Double click on:

From the Octave command line interface, load the java package:
octave> pkg load java

Check that java 1.2.9 package is installed
octave> pkg list
=> java *| 1.2.9 | C:\Octave\Octave3.6.4_gcc4.6.2\share\octave\packages\java-1.2.9

Initialize Java facilities …

octave> openSimModelingJar=”c:/OpenSim 3.0/opensim/modules/org-opensim-modeling.jar”
octave> javaaddpath(openSimModelingJar)
octave> openSimBinDir=”c:/OpenSim 3.0/bin/”
octave> addpath(openSimBinDir)

… and now you can test the API loading

octave> testModelPath=”C:/OpenSim 3.0/Models/WristModel/wrist.osim”
octave> wristModel = java_new(“org.opensim.modeling.Model”,testModelPath)

Loaded model Wrist Model from file C:/OpenSim 3.0/Models/WristModel/wrist.osim
obj = <Java object: org.opensim.modeling.Model>

You have now full access to the Model OpenSim API, for example you can query the wrist model for joint number

octave> wristModel.getNumJoints()
ans = 28

Tags: ,


© 2018