Moco with Upper-Extremity

OpenSim Moco is a software toolkit to solve optimal control problems with musculoskeletal models defined in OpenSim using the direct collocation method.
POST REPLY
User avatar
Mazen Al Borno
Posts: 3
Joined: Mon Mar 14, 2016 6:20 pm

Moco with Upper-Extremity

Post by Mazen Al Borno » Mon Mar 07, 2022 9:52 pm

Hi all,

I'm trying to use Moco on the upper-extremity model: https://simtk.org/frs/?group_id=657 to do a predictive simulation in Python.

However Moco does not converge and I get the error:
RuntimeError: std::exception in 'void OpenSim::MocoTrajectory::write(std::string const &) const': This trajectory is sealed, to force you to acknowledge the solver failed; call unseal() to gain access

When I change the code to unseal (i.e., predictSolution = study.solve().unseal()), I get a segmentation error.
I'm wondering if the upper-extremity model doesn't work with Moco for some reason? Also, is Ross Miller's walking code the best example of a predictive simulation with a musculoskeletal model (I haven't found other examples, so I just wanted to make sure I'm not overlooking something else).

Thanks,

Mazen

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

Re: Moco with Upper-Extremity

Post by Nicholas Bianco » Tue Mar 08, 2022 10:08 am

Hey Mazen,

For some reason, in Python you need to call "unseal()" in a separate line:

Code: Select all

solution = study.solve()
solutionUnsealed = solution.unseal()
I'm still not sure why this is the case, but an easy fix nevertheless.

In addition to Ross' stuff, you can check example2DWalking that is packaged with Moco for another predictive walking example.

Best,
Nick

User avatar
Mazen Al Borno
Posts: 3
Joined: Mon Mar 14, 2016 6:20 pm

Re: Moco with Upper-Extremity

Post by Mazen Al Borno » Tue Mar 08, 2022 10:48 am

Thanks so much. I was able to visualize my non-converged solution this way.
all the best,
Mazen

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

Re: Moco with Upper-Extremity

Post by Ross Miller » Tue Mar 08, 2022 10:49 am

My code is an elaborate version of the example2Dwalking code. I started from that and added things to it, but it's not fundamentally different from that example.

Ross

POST REPLY