Problem implementing the code/data available on Moco project "Muscle-Driven Simulations and Experimental Data of Cycling

OpenSim Moco is a software toolkit to solve optimal control problems with musculoskeletal models defined in OpenSim using the direct collocation method.
User avatar
Muhammad Mughees Ahmed
Posts: 17
Joined: Mon Sep 18, 2023 3:22 am

Problem implementing the code/data available on Moco project "Muscle-Driven Simulations and Experimental Data of Cycling

Post by Muhammad Mughees Ahmed » Wed Jan 31, 2024 8:50 am

Hello,

I am trying to implement the code/data (available on SimTK) of project "Muscle-Driven Simulations and Experimental Data of Cycling".

The code is implemented in 2021b Matlab as mentioned in paper of the project. I am also using the same, but when i am running the code it is showing the following error


Unrecognized function or variable 'processAndConvertToRadians'.

Error in solveMocoInverseCycling_J1 (line 119)
kinematicsNeeded = tableProcessor.processAndConvertToRadians(model);

Error in runMocoInverseCycling (line 7)
solveMocoInverseCycling_J1('P01',120.63,122.9, eeWeight, '_J1_P01_result')


I have followed all the steps as mentioned in readme files but still am facing this issue.
As per my understanding it seems that the syntax for converting radian to degree in the code is not correct (I might eb wrong ).

Need help in solving this error and run this code for understanding.

Best Regards

User avatar
Nicholas Bianco
Posts: 1036
Joined: Thu Oct 04, 2012 8:09 pm

Re: Problem implementing the code/data available on Moco project "Muscle-Driven Simulations and Experimental Data of Cyc

Post by Nicholas Bianco » Wed Jan 31, 2024 10:58 am

Hi Muhammad,

What version of OpenSim do you have installed? It seems like you might have an old install, the lastest OpenSim versions (which include Moco) can be found here: https://simtk.org/frs/?group_id=91.

Best,
Nick

User avatar
Muhammad Mughees Ahmed
Posts: 17
Joined: Mon Sep 18, 2023 3:22 am

Re: Problem implementing the code/data available on Moco project "Muscle-Driven Simulations and Experimental Data of Cyc

Post by Muhammad Mughees Ahmed » Thu Feb 01, 2024 4:53 am

Hi Nick,

Thank you for the reply, i was trying it in opensim 4.4, but yeah i will try it in this new version of open sim and check if it resolves the matter.

thanks for the help.

Mughees

User avatar
Muhammad Mughees Ahmed
Posts: 17
Joined: Mon Sep 18, 2023 3:22 am

Re: Problem implementing the code/data available on Moco project "Muscle-Driven Simulations and Experimental Data of Cyc

Post by Muhammad Mughees Ahmed » Thu Feb 01, 2024 6:25 am

Hi Nick,

I tried installing the new opensim and moco 0.4.0 along with matlab 2021b. but still the problem is same when i run the code.

Unrecognized function or variable 'processAndConvertToRadians'.

Error in solveMocoInverseCycling_J1 (line 119)
kinematicsNeeded = tableProcessor.processAndConvertToRadians(model);

Error in runMocoInverseCycling (line 7)
solveMocoInverseCycling_J1('P01',120.63,122.9, eeWeight, '_J1_P01_result')


do you have any idea how to solve that?

in my opinion (i might be wrong also) that the syntax of calling a function for converting the model into radians is not right or maybe not according to the new version of opensim or moco.

best regards
Mughees

User avatar
Nicholas Bianco
Posts: 1036
Joined: Thu Oct 04, 2012 8:09 pm

Re: Problem implementing the code/data available on Moco project "Muscle-Driven Simulations and Experimental Data of Cyc

Post by Nicholas Bianco » Thu Feb 01, 2024 2:42 pm

Hi Mughees,

OpenSim 4.4 should work fine (Moco 0.4.0 is a much older version and shouldn't be used anymore).

My guess is that you don't have OpenSim installed correctly. Are you able to run other examples with your current OpenSim 4.4 install?

Best,
Nick

User avatar
Muhammad Mughees Ahmed
Posts: 17
Joined: Mon Sep 18, 2023 3:22 am

Re: Problem implementing the code/data available on Moco project "Muscle-Driven Simulations and Experimental Data of Cyc

Post by Muhammad Mughees Ahmed » Fri Feb 02, 2024 4:05 am

Hi Nick
Last edited by Muhammad Mughees Ahmed on Fri Feb 02, 2024 4:24 am, edited 3 times in total.

User avatar
Muhammad Mughees Ahmed
Posts: 17
Joined: Mon Sep 18, 2023 3:22 am

Re: Problem implementing the code/data available on Moco project "Muscle-Driven Simulations and Experimental Data of Cyc

Post by Muhammad Mughees Ahmed » Fri Feb 02, 2024 4:23 am

Hi Nick,

I downloaded the Moco from the following link, I thought its the latest release

https://simtk.org/projects/opensim-moco

Just for clarification, I am a very new user of Moco, so i am just learning everything about it. so at times my question can sound very basic (sorry for that).
The examples i found in the package of moco or open sim work fine usually.
Only thing i face is that whenever i execute a "study.visualize(......);" command, when i close the visualization dialoguebos it sows the following error in command box of matlab.
Error using example2DWalking

Java exception occurred:
java.lang.RuntimeException: SimTK Exception thrown at VisualizerProtocol.cpp:609:
Error detected by Simbody method VisualizerProtocol: An attempt to write() 1 bytes to pipe 6 failed with errno=22 (Invalid
argument).
(Required condition 'status!=-1' was not met.)


at org.opensim.modeling.opensimMocoJNI.MocoStudy_visualize(Native Method)

at org.opensim.modeling.MocoStudy.visualize(MocoStudy.java:129)




Can you suggest me from where i can download the latest version of Moco, maybe configuring that with my matlab will solve the issue

this is the path of my computer, i was using opensim 4.4 but now also installed opensim 4.5 also. You think the path setting is right ?
Screenshot 2024-02-02 110118.png
Screenshot 2024-02-02 110118.png (36.66 KiB) Viewed 20806 times



Best regards
Mughees

User avatar
Ross Miller
Posts: 374
Joined: Tue Sep 22, 2009 2:02 pm

Re: Problem implementing the code/data available on Moco project "Muscle-Driven Simulations and Experimental Data of Cyc

Post by Ross Miller » Fri Feb 02, 2024 6:49 am

Hi Mughees,

Moco is part of recent releases of the OpenSim software. You don't need to download and install Moco separately from OpenSim itself. I would guess that having the 0.x release of Moco installed along with OpenSim might be causing problems.

Ross

User avatar
Muhammad Mughees Ahmed
Posts: 17
Joined: Mon Sep 18, 2023 3:22 am

Re: Problem implementing the code/data available on Moco project "Muscle-Driven Simulations and Experimental Data of Cyc

Post by Muhammad Mughees Ahmed » Fri Feb 02, 2024 7:36 am

Hi Ross,

Thank you for the rely, in that case then how can i configure moco with matlab.
because in the latest release there is a file which we can run to configure opensim, but we do nothave any file to configure moco.

regards
mughees

User avatar
Ross Miller
Posts: 374
Joined: Tue Sep 22, 2009 2:02 pm

Re: Problem implementing the code/data available on Moco project "Muscle-Driven Simulations and Experimental Data of Cyc

Post by Ross Miller » Fri Feb 02, 2024 3:44 pm

Configuring the latest OpenSim release with Matlab should also include Moco.

POST REPLY