opensim-moco icon indicating copy to clipboard operation
opensim-moco copied to clipboard

MATLAB example fixes

Open carmichaelong opened this issue 5 years ago • 7 comments

Tested on Windows 10, MATLAB R2019a

exampleMarkerTracking10DOF: set_weight doesn't exist for scripting https://github.com/opensim-org/opensim-moco/blob/master/Moco/Bindings/Java/Matlab/Examples/exampleMarkerTracking10DOF/exampleMarkerTracking10DOF.m#L108

exampleSitToStand: as noted in #481

exampleMocoTrack: issue with muscleDrivenStateTracking() with unseal(), possibly related to #494? Error below:

MocoCasADiSolver did NOT succeed:
  Invalid_Number_Detected
===============================================================================
Error using exampleMocoTrack>muscleDrivenStateTracking (line 194)
Java exception occurred:
java.lang.RuntimeException: This iterate is sealed, to force you to acknowledge the
solver failed; call unseal() to gain access.
	Thrown at MocoTrajectory.cpp:1302 in ensureUnsealed().

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

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


Error in exampleMocoTrack (line 54)
muscleDrivenStateTracking();

I can definitely make quick fixes to the first two. Likely would need some direction about the third issue.

carmichaelong avatar Nov 26 '19 19:11 carmichaelong

@carmichaelong just to clarify, you are calling unseal(), as in study.solve().unseal()? Per #494, it would be good to try both that and

solution = study.solve()
solutionUnsealed = solution.unseal()
study.visualize(solutionUnsealed)

nickbianco avatar Nov 26 '19 19:11 nickbianco

@chrisdembia we should update that message to say This trajectory is sealed, to force you....

nickbianco avatar Nov 26 '19 19:11 nickbianco

I didn't explicitly call unseal() from MATLAB. I was running exampleMocoTrack as is, and that error occurs, pointing at https://github.com/opensim-org/opensim-moco/blob/master/Moco/Bindings/Java/Matlab/Examples/exampleMocoTrack/exampleMocoTrack.m#L194

Maybe an unseal() call needs to be added to the example then?

carmichaelong avatar Nov 26 '19 19:11 carmichaelong

I think we shouldn't add unseal() to any examples unless we are demonstrating unseal().

chrisdembia avatar Nov 26 '19 19:11 chrisdembia

Invalid_Number_Detected also occurred for me in the C++ example for the muscle driven part of ExampleMocoTrack

carmichaelong avatar Nov 27 '19 02:11 carmichaelong

We need to disable tendon compliance for that example

chrisdembia avatar Nov 27 '19 02:11 chrisdembia

Sorry I didn’t realize you were working on exampleMocoTrack. Use ModOpIgnoreTendonCompliance.

chrisdembia avatar Nov 27 '19 02:11 chrisdembia