running ScaletOOL API
- Firooz Salami
- Posts: 29
- Joined: Sat Jun 20, 2015 1:02 am
running ScaletOOL API
Hello,
I am trying to run ScaleTool through MATLAB R2014a but I couldn't find run command for ScaleTool in API docs and when I run ScaleTool.run() I get error messages from MATLAB fileparts as below
myscale = ScaleTool(myScaleSetup);
myscale.run()
Error using fileparts (line 32)
Input must be a row vector of characters.
Would you please help me to generate my scaled model in MATLAB?
Regards
Firooz
I am trying to run ScaleTool through MATLAB R2014a but I couldn't find run command for ScaleTool in API docs and when I run ScaleTool.run() I get error messages from MATLAB fileparts as below
myscale = ScaleTool(myScaleSetup);
myscale.run()
Error using fileparts (line 32)
Input must be a row vector of characters.
Would you please help me to generate my scaled model in MATLAB?
Regards
Firooz
- Thomas Uchida
- Posts: 1792
- Joined: Wed May 16, 2012 11:40 am
Re: running ScaletOOL API
There are some relevant examples on Confluence (https://simtk-confluence.stanford.edu/d ... +Tutorials, e.g., Tutorial 3) and additional links here: viewtopicPhpbb.php?f=91&t=8425.
- Firooz Salami
- Posts: 29
- Joined: Sat Jun 20, 2015 1:02 am
Re: running ScaletOOL API
Dear Tom,
Thanks for the reply but this is not what I meant. I know how to work with ScaleTool in OpenSim GUI.
I can run IKtool, IDtool and Analysis tool on matlab directly (without using OpenSim GUI) for gait model 2392 but I cannot run Scale tool in matlab directly and I don't know which function or command will perform the scale tool running in matlab ( I couldn't find it in API docs).
regards
Firooz
Thanks for the reply but this is not what I meant. I know how to work with ScaleTool in OpenSim GUI.
I can run IKtool, IDtool and Analysis tool on matlab directly (without using OpenSim GUI) for gait model 2392 but I cannot run Scale tool in matlab directly and I don't know which function or command will perform the scale tool running in matlab ( I couldn't find it in API docs).
regards
Firooz
- Thomas Uchida
- Posts: 1792
- Joined: Wed May 16, 2012 11:40 am
Re: running ScaletOOL API
The ScaleTool contains a ModelScaler (https://simtk.org/api_docs/opensim/api_ ... caler.html) and a MarkerPlacer (https://simtk.org/api_docs/opensim/api_ ... lacer.html), as you see in the GUI. You will need to do something like
https://simtk.org/api_docs/opensim/api_ ... 1b85ed4ff2
Code: Select all
status = myScaleTool.getModelScaler().processModel(state, model);
- Firooz Salami
- Posts: 29
- Joined: Sat Jun 20, 2015 1:02 am
Re: running ScaletOOL API
Many Thanks.
I think the code would be useful though Matlab crashes after running it.
Regards
Firooz
I think the code would be useful though Matlab crashes after running it.
Regards
Firooz
- Thomas Uchida
- Posts: 1792
- Joined: Wed May 16, 2012 11:40 am
Re: running ScaletOOL API
I have attached example files that you can find in your OpenSim installation directory (under Models\Gait2354_Simbody). Here's the MATLAB code:
Code: Select all
import org.opensim.modeling.*
tool = ScaleTool('subject01_Setup_Scale.xml');
model = Model('gait2354_simbody.osim');
state = model.initSystem();
tool.getModelScaler().processModel(state, model);
- Attachments
-
- scaleToolFiles.zip
- Example files for running Scale Tool
- (195.75 KiB) Downloaded 35 times
- Firooz Salami
- Posts: 29
- Joined: Sat Jun 20, 2015 1:02 am
Re: running ScaletOOL API
Dear Tom,
Thanks.
The Code works fine. I am trying to run the same for MarkerPlacer.
regards
Firooz
Thanks.
The Code works fine. I am trying to run the same for MarkerPlacer.
regards
Firooz
- Firooz Salami
- Posts: 29
- Joined: Sat Jun 20, 2015 1:02 am
Re: running ScaletOOL API
tool.getMarkerPlacer().processModel(state,model)
Java exception occurred:
java.lang.RuntimeException: AssemblySolver::assemble() Failed: SimTK Exception thrown at Assembler.cpp:227:
Error detected by Simbody method AssemblerSystem::objectiveFunc(): calcGoal() method of assembly condition Markers returned a negative or non-finite value -1.#IND.
(Required condition 'goalValue >= 0' was not met.)
Java exception occurred:
java.lang.RuntimeException: AssemblySolver::assemble() Failed: SimTK Exception thrown at Assembler.cpp:227:
Error detected by Simbody method AssemblerSystem::objectiveFunc(): calcGoal() method of assembly condition Markers returned a negative or non-finite value -1.#IND.
(Required condition 'goalValue >= 0' was not met.)
- Thomas Uchida
- Posts: 1792
- Joined: Wed May 16, 2012 11:40 am
Re: running ScaletOOL API
The exception is thrown from the Assembler::objectiveFunc() method (https://github.com/simbody/simbody/blob ... #L206-L234) because there are no markers attached to the model. Try using a model file whose MarkerSet is non-empty (e.g., [your OpenSim installation directory]\Models\Gait2354_Simbody\OutputReference\subject01_simbody.osim).
- Firooz Salami
- Posts: 29
- Joined: Sat Jun 20, 2015 1:02 am
Re: running ScaletOOL API
Well, I am not sure if it is the reason because 1 ) I ran the code for gait2392_simbody.osim or Gait2354_Simbody\OutputReference\subject01_simbody.osim with their static.trc and markerset file ( or mine) I get following error
ava exception occurred:
java.lang.RuntimeException: InverseKinematicsSolver: Model has no markers!
at org.opensim.modeling.opensimModelJNI.MarkerPlacer_processModel__SWIG_1(Native Method)
at org.opensim.modeling.MarkerPlacer.processModel(MarkerPlacer.java:77)
but as soon as I use Hamner full body model ( which has marker set) the problem is solved.
but when I use my own static.trc and markerset file with hamner model I get the error
Java exception occurred:
java.lang.RuntimeException: AssemblySolver::assemble() Failed: SimTK Exception thrown at Assembler.cpp:227:
Error detected by Simbody method AssemblerSystem::objectiveFunc(): calcGoal() method of assembly condition Markers returned a negative or non-finite value -1.#IND.
(Required condition 'goalValue >= 0' was not met.)
at org.opensim.modeling.opensimModelJNI.MarkerPlacer_processModel__SWIG_1(Native Method)
at org.opensim.modeling.MarkerPlacer.processModel(MarkerPlacer.java:77)
I compared the marker sets and trc files and find no differences but the time and also I can scale using GUI. is it possible that I use different marker names?
ava exception occurred:
java.lang.RuntimeException: InverseKinematicsSolver: Model has no markers!
at org.opensim.modeling.opensimModelJNI.MarkerPlacer_processModel__SWIG_1(Native Method)
at org.opensim.modeling.MarkerPlacer.processModel(MarkerPlacer.java:77)
but as soon as I use Hamner full body model ( which has marker set) the problem is solved.
but when I use my own static.trc and markerset file with hamner model I get the error
Java exception occurred:
java.lang.RuntimeException: AssemblySolver::assemble() Failed: SimTK Exception thrown at Assembler.cpp:227:
Error detected by Simbody method AssemblerSystem::objectiveFunc(): calcGoal() method of assembly condition Markers returned a negative or non-finite value -1.#IND.
(Required condition 'goalValue >= 0' was not met.)
at org.opensim.modeling.opensimModelJNI.MarkerPlacer_processModel__SWIG_1(Native Method)
at org.opensim.modeling.MarkerPlacer.processModel(MarkerPlacer.java:77)
I compared the marker sets and trc files and find no differences but the time and also I can scale using GUI. is it possible that I use different marker names?