IK error in Matlab API

Provide easy-to-use, extensible software for modeling, simulating, controlling, and analyzing the neuromusculoskeletal system.
POST REPLY
User avatar
Gil Serrancolí
Posts: 9
Joined: Thu Mar 17, 2011 1:37 am

IK error in Matlab API

Post by Gil Serrancolí » Mon Nov 19, 2012 6:05 pm

Hello,

I am running Inverse Kinematics with GUI and it works well. But now I want to run through Matlab because I need to process several files. But I have the following error:
Constructing tool from setup file Setup_InverseKinematics.xml.

reading object from file ...
Loaded model ...
Running tool ...
Loaded marker file ...
InverseKinematicsTool Failed: AssemblySolver::assemble() Failed: SimTK Exception thrown at Assembler.cpp:842:
Method Assembler::assemble() failed because:
Optimizer failed with message: SimTK Exception thrown at Assembler.cpp:225:
Error detected by Simbody method AssemblerSystem::objectiveFunc(): calcGoal() method of assembly condition Markers returned a negative or non-finite value -1.#IND.
(Required condition 'goalValue >= 0' was not met.)

Assembly error tolerance achieved: 0 required: 1e-006.
Exception in IK: InverseKinematicsTool Failed, please see messages window for details...
It seems that reads the model ok as well as gets the information from the .trc file, but then it gets this SimTK error that I don't understand.

Could anybody help me?

Thank you very much,

Gil Serrancolí

User avatar
Ayman Habib
Posts: 2236
Joined: Fri Apr 01, 2005 12:24 pm

Re: IK error in Matlab API

Post by Ayman Habib » Tue Nov 20, 2012 1:14 pm

Hi Gil,

Both the Matlab interface and GUI invoke the same code underneath so it's likely not a bug in the underlying code but an issue with passing along the information to the underlying tool. More than likely this has to do with where the code expects the files to be located. A couple things I'd recommend:
1. Looking into the Matlab API examples, one of them runs multiple IK trials, and see how the setup files there are different from yours.
2. Since you can run from the GUI without problem, I'd think the issue may have to do with not finding the tasks file or additional markers if you need them. Please compare the log in the messages window of the GUI for a successful run vs. the output in Matlab and you should be able to zone in on the problem. In general, the GUI jumps thru many hoops to try to use relative paths if possible but the API has no concept of working directory so you'd need full/absolute path specification in setup files when using the API while you can get away with using relative paths in the GUI.

Hope this helps and please let me know how it goes,
-Ayman

User avatar
Gil Serrancolí
Posts: 9
Joined: Thu Mar 17, 2011 1:37 am

Re: IK error in Matlab API

Post by Gil Serrancolí » Wed Nov 21, 2012 8:10 am

Thank you very much Ayman,

There was a problem in the file paths. I've fixed it and now it works.

Gil

User avatar
Kazutaka Takahashi
Posts: 16
Joined: Tue Jan 29, 2008 4:48 pm

Re: IK error in Matlab API

Post by Kazutaka Takahashi » Tue Feb 26, 2013 1:30 pm

I actually have a similar issue, but not through Matlab API:
At Opensim 3.0, after I seemed to get a reasonable scaled version of a model, once I start running IK, I get the following:

Running tool .
Loaded marker file X:\RG\Lester\20130111\Vicon_template\RG\Lester\Trial2.trc (30 markers, 26040 frames)
Frame 1 (t=5.604): total squared error = 0.00140054, marker error: RMS=0.00683261, max=0.0163247 (D1_1)
Frame 2 (t=5.608): total squared error = 0.00136291, marker error: RMS=0.0067402, max=0.0162795 (D1_1)
AssemblySolver::track() attempt Failed: SimTK Exception thrown at Assembler.cpp:896:
Method Assembler::track() failed because:
Optimizer failed with message: SimTK Exception thrown at InteriorPointOptimizer.cpp:261:
Optimizer failed: Ipopt: Restoration failed (status -2)
Assembly error tolerance achieved: 9.69985678819337e-011 required: 1e-006.
InverseKinematicsTool Failed: AssemblySolver::track() attempt failed.

So, at least it makes a step in time, then stops...

POST REPLY