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
ID output
- David John Saxby
- Posts: 83
- Joined: Mon May 09, 2011 8:39 pm
Re: ID output
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
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
- Karen Roemer
- Posts: 4
- Joined: Fri Mar 19, 2010 7:31 am
Re: ID output
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
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
- David John Saxby
- Posts: 83
- Joined: Mon May 09, 2011 8:39 pm
Re: ID output
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
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
- Karen Roemer
- Posts: 4
- Joined: Fri Mar 19, 2010 7:31 am
Re: ID output
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
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
- Attachments
-
- run_ID_PS1S_CG1.txt
- (6.35 KiB) Downloaded 31 times
- Ayman Habib
- Posts: 2252
- Joined: Fri Apr 01, 2005 12:24 pm
Re: ID output
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
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
- Karen Roemer
- Posts: 4
- Joined: Fri Mar 19, 2010 7:31 am
Re: ID output
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
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
- Ayman Habib
- Posts: 2252
- Joined: Fri Apr 01, 2005 12:24 pm
Re: ID output
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
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
- Ayman Habib
- Posts: 2252
- Joined: Fri Apr 01, 2005 12:24 pm
Re: ID output
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
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