Page 1 of 1

Moco with Upper-Extremity

Posted: Mon Mar 07, 2022 9:52 pm
by maz
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

Re: Moco with Upper-Extremity

Posted: Tue Mar 08, 2022 10:08 am
by nbianco
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

Re: Moco with Upper-Extremity

Posted: Tue Mar 08, 2022 10:48 am
by maz
Thanks so much. I was able to visualize my non-converged solution this way.
all the best,
Mazen

Re: Moco with Upper-Extremity

Posted: Tue Mar 08, 2022 10:49 am
by rosshm
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