Page 1 of 1

ID output

Posted: Mon Apr 22, 2013 12:18 am
by kroemer
Hi!
I try to calculate multiple trials of a single leg stance. The scripting for running multiple trials in IK worked great. Now I want to run a script, so that I can run the ID for all these trials but I am getting stuck on the output file (inverse_dynamics.sto). How can I define a dynamic output-file name? Or is there any way to define a specific folder for the output file?

Thanks!

Karen

Re: ID output

Posted: Tue Apr 23, 2013 1:04 am
by saxbyd
Karen,

If you look in the xml file for the ID setup you'll find

1) results directory. You can set the path so your output goes to a nice place.

2) output_gen_force_file. This is the name of the output file. You can change it, manually or through some code.

Cheers,

David

Re: ID output

Posted: Tue Apr 23, 2013 1:30 pm
by kroemer
David,

Thanks for your reply!

Can you tell me more about the code? I am trying to avoid to change the ID setup files manually for each trial.

I found the "getOutputGenForceFileName ()" which I use in my script, but I have no clue to set the file name via jython.

Thanks

Karen

Re: ID output

Posted: Tue Apr 23, 2013 3:10 pm
by saxbyd
Hi Karen,

No idea about jython. I use the matlab wrappers to access the API.

Forgive the basic question: is there a setOutputGenForceFileName()?

Get and set are present using the Matlab scripting, not sure how jython script would address the same issue.

How do you set other values or files in your script?

David

Re: ID output

Posted: Tue Apr 23, 2013 4:24 pm
by kroemer
H David,
I tried the setOutputGen... but it did not work and when I searched the scripting help pages I could only find the getOutputGen... for the inverse dynamics and was wondering if I miss something. For the inverse kinematics you can set the filename with the set and get keywords, but I guess I should try matlab then! I never tried to run opensim via matlab so far... do you have a sample matlab-script you would be willing to share for running inverse dynamics via matlab to get me started? I attached my py-script (had to change the extension to txt to be able to attach it).

Thanks for your help!

Karen

Re: ID output

Posted: Tue Apr 23, 2013 4:54 pm
by aymanh
Hi David & Karen,

The method to set the name of the output file from ID is not exposed to Java (which is used by both Jython and Matlab). I added a method & exposed it and it should be available in the next release (which will be posted in beta form in a few days).

Thanks very much for reporting and best regards,
-Ayman

Re: ID output

Posted: Tue Apr 23, 2013 5:53 pm
by kroemer
Ayman,
that's great news! Thanks :)
Would you recommend one way over the other with respect to scripting? I am just getting started with Jython and am familiar with matlab, too.

Thanks!

Karen

Re: ID output

Posted: Wed Apr 24, 2013 1:53 am
by aymanh
Hi Karen,

In terms of access to OpenSim classes and tools, the Jython shell in the GUI and scripting in Matlab do the same thing and exercise the same code, but because of the context they offer different advantages.

The GUI scripting shell gives access to the plotter, graphics window and other commands available in the OpenSim application, while you can leverage the variety of tools, optimizers and tool-boxes in Matlab as well as the API-visualizer. If you're familiar with Matlab already, you also save yourself learning new syntax.

It boils down to what you're trying to accomplish and which tools you want to leverage to achieve your goals.

Hope this helps,
-Ayman

Re: ID output

Posted: Mon Apr 29, 2013 1:52 pm
by aymanh
Hi Karen,

We just posted 3.1 beta that has the method InverseDynamicsTool.setOutputGenForceFileName( ) exposed. Please give it a try and let us know how it goes.

Best regards,
-Ayman