Page 1 of 1

Learning how to use command line from terminal

Posted: Wed Mar 27, 2019 3:25 am
by mick
Hello, I am learning openSim 4 and I would like to be able to lunch a simulation (IK or forward or ...) of a simple tutorial example but do not understand what I should do.
For example if I want to use the simplest example (it seems to me it could be bouncing_block but any other is fine) and run a tool what should I write in the terminal?

Re: Learning how to use command line from terminal

Posted: Thu Mar 28, 2019 2:27 am
by mitkof6
The best place to start is the user guide:

https://simtk-confluence.stanford.edu:8 ... %27s+Guide

You can find many examples, use cases, etc. Please let us know what exactly you want to do with OpenSim in case that the user guide is not helpful enough.

Re: Learning how to use command line from terminal

Posted: Thu Mar 28, 2019 4:14 am
by mick
I tried the only example I found in the guide, but why should it work (I do not have such a file, path info,...)?

This is the error I get:

SimTK Exception thrown at xml.cpp:108:
Error detected by Simbody method Xml::readFromFile(): Failed to load the Xml file 'arm26_Setup_InverseKinetics.xml' with error 'Failed to open file (line=0, col=0)'.
(Required condition 'loadOK' was not met.)

Re: Learning how to use command line from terminal

Posted: Mon Apr 01, 2019 4:45 am
by mick
My question comes from my hope to run directly simtk (without GUI), any advice?

Re: Learning how to use command line from terminal

Posted: Thu Apr 04, 2019 1:45 am
by mick
Hi, maybe I made a small improvement as with correct path opensim tries to run an example XML inverse dinamics file, but it searches a .osim file that it does not find it (neither do I) on examples models

C:\Users\Laura>opensim-cmd run-tool Documenti\OpenSim\4.0\Models\Gait2354_Simbod
y\subject01_Setup_InverseDynamics.xml
Preparing to run InverseDynamicsTool.
InverseDynamicsTool Failed: Object: Cannot open file subject01_simbody.osim. It
may not exist or you do not have permission to read it.
Thrown at object.cpp:105 in Object().
InverseDynamicsTool Failed, please see messages window for details...

Re: Learning how to use command line from terminal

Posted: Thu Apr 04, 2019 12:01 pm
by aymanh
Hello,

As you can tell from the message the model you're trying to run on is not found because file name is assumed relative to working directory unless otherwise specified.

Typically if you want to use a model from another folder you would specify full pathname for the model osim file. Assuming default OpenSim 4.0 layout the model file you want would be located at
C:\Users\${USER}\Documents\OpenSim\4.0\Models\Gait2354_Simbody\OutputReference

Hope this helps,
-Ayman

Re: Learning how to use command line from terminal

Posted: Mon Apr 08, 2019 7:21 am
by micheal
Thanks very much for the patience and I am sure that soon we will find the solution to my confusion.

I think that I am doing some other kind of error when trying to launch a inverse dynamic simulation from terminal:

opensim-cmd run-tool Documents\OpenSim\4.0\Models\Gait2354_Simbody\subject01_Setup_InverseDynamics.xml

This file path is found and opensim looks for the .osim file subject01_simbody.osim that subject01_Setup_InverseDynamics.xml needs (which I also copied in the same directory and left in the original folder) but probably I should have written a different command line in the terminal or written before a command to open the .osim file.