Hi,
I'm new to Moco and to opensim. Thanks for this great tool!
I'm trying to run "example2DWalking" (through Matlab) and getting the following error:
Error using example2DWalking
Java exception occurred:
java.lang.RuntimeException: Object: Cannot open file 2D_gait.osim. It may not exist or you do not
have permission to read it.
Thrown at Object.cpp:105 in Object().
at org.opensim.modeling.opensimMocoJNI.MocoTrack_initialize(Native Method)
at org.opensim.modeling.MocoTrack.initialize(MocoTrack.java:695)
I am able to load 2D_gait.osim directly in OpenSim (and to simulate it). So I don't think that this is a permission issue.
Also, I am able to run "exampleSlidingMass" directly from Matlab. So, does not seem like a path issue.
Any idea why I'm getting this issue?
thanks
newbie question
- Nicholas Bianco
- Posts: 1057
- Joined: Thu Oct 04, 2012 8:09 pm
Re: newbie question
Hi Adam,
You could try running Matlab in Administrator mode to see if that helps. Otherwise, if you're in the directory with the model when you run the script, then I'm not sure what's wrong.
-Nick
You could try running Matlab in Administrator mode to see if that helps. Otherwise, if you're in the directory with the model when you run the script, then I'm not sure what's wrong.
-Nick
- Adam Zaidel
- Posts: 7
- Joined: Sun Feb 05, 2023 2:28 am
Re: newbie question
Hi Nick
Indeed it was just a directory issue.
I had assumed that Matlab would find the model if it lies in the Matlab path (in the same way that it finds the .m file)
Thanks!
Indeed it was just a directory issue.
I had assumed that Matlab would find the model if it lies in the Matlab path (in the same way that it finds the .m file)
Thanks!
- Adam Zaidel
- Posts: 7
- Joined: Sun Feb 05, 2023 2:28 am
Re: newbie question
Hi,
I'm running into another issue now. When the script (example2DWalking.m) gets to the line 'opensimMoco.writeTableToFile(externalForcesTableFlat, ... Matlab gives the following error:
Unrecognized function or variable 'writeTableToFile'.
I think that the Moco libraries are loaded properly because calls to other opensimMoco functions earlier in the script work fine. And 'opensimMoco.GetMocoVersion' returns
ans =
4.4-2022-07-23-0e9fedc
when I look at the loaded functions in Matlab (libfunctionsview(opensimMoco)) I don't see any function 'writeTableToFile'
any idea what the problem is?
thanks
Adam
I'm running into another issue now. When the script (example2DWalking.m) gets to the line 'opensimMoco.writeTableToFile(externalForcesTableFlat, ... Matlab gives the following error:
Unrecognized function or variable 'writeTableToFile'.
I think that the Moco libraries are loaded properly because calls to other opensimMoco functions earlier in the script work fine. And 'opensimMoco.GetMocoVersion' returns
ans =
4.4-2022-07-23-0e9fedc
when I look at the loaded functions in Matlab (libfunctionsview(opensimMoco)) I don't see any function 'writeTableToFile'
any idea what the problem is?
thanks
Adam
- Adam Zaidel
- Posts: 7
- Joined: Sun Feb 05, 2023 2:28 am
[problem solved] Re: newbie question
problem solved: running the script from the Opensim directory (rather than the directory downloaded with opensim-moco-0.4.0-win) worked
- Nicholas Bianco
- Posts: 1057
- Joined: Thu Oct 04, 2012 8:09 pm
Re: newbie question
Hi Adam,
When you installed OpenSim, did you add the bin folder to your PATH? That might be the problem. You shouldn't have to run the script from a specific directory.
Also, I would recommend using the current version of Moco, which now ships with each new version of OpenSim: https://simtk.org/frs/?group_id=91.
Best,
Nick
When you installed OpenSim, did you add the bin folder to your PATH? That might be the problem. You shouldn't have to run the script from a specific directory.
Also, I would recommend using the current version of Moco, which now ships with each new version of OpenSim: https://simtk.org/frs/?group_id=91.
Best,
Nick
- Adam Zaidel
- Posts: 7
- Joined: Sun Feb 05, 2023 2:28 am
Re: newbie question
Hi Nick,
My point (which I see I did not explain properly) is that I was running an old m-file (that which was downloaded with moco) rather than that which was downloaded with OpenSim. I think that what confused me was this (from the help):
"Note
On Windows, set your Windows PATH environment variable to include <OpenSim-Moco-Install>/bin before any other OpenSim/OpenSense paths."
I had understood from that the moco paths should come before opensim paths (which I applied also to the Matlab files).
Only later I saw the form post that moco is now integrated in opensim (so I moved opensim m-files up in the path and remove paths to the mfiles that came with the moco download) - and now it all works
So, perhaps you might want to consider changing that line from the help?
this is a fantastic resource - thank you so much!
Adam
My point (which I see I did not explain properly) is that I was running an old m-file (that which was downloaded with moco) rather than that which was downloaded with OpenSim. I think that what confused me was this (from the help):
"Note
On Windows, set your Windows PATH environment variable to include <OpenSim-Moco-Install>/bin before any other OpenSim/OpenSense paths."
I had understood from that the moco paths should come before opensim paths (which I applied also to the Matlab files).
Only later I saw the form post that moco is now integrated in opensim (so I moved opensim m-files up in the path and remove paths to the mfiles that came with the moco download) - and now it all works
So, perhaps you might want to consider changing that line from the help?
this is a fantastic resource - thank you so much!
Adam
- Nicholas Bianco
- Posts: 1057
- Joined: Thu Oct 04, 2012 8:09 pm
Re: newbie question
Hi Adam,
Glad you got it to work! Yes, the version of OpenSim that you're currently working with should always be at the top of the Windows PATH. Matlab's path works separately, but it is the same idea.
-Nick
Glad you got it to work! Yes, the version of OpenSim that you're currently working with should always be at the top of the Windows PATH. Matlab's path works separately, but it is the same idea.
-Nick