Page 1 of 1

Controllers definition (memory issue?)

Posted: Tue Jun 23, 2015 8:11 am
by gilserrancoli
Dear,

I am trying to run forward dynamics from a mexfile that we created. When it is executed for the first time, it seems to work properly. But, when it is executed for the second time, Matlab crashes. It seems to be a memory issue, but I don't know how to solve it. Then, the only option is restarting Matlab.

The model is torque driven. It has correction controllers to try to follow the kinematics.

The second time that it is executed it crashes when adding the controls to the model. It is at the 4th line of the following piece of code:

Code: Select all

ControlSetController* controller = new ControlSetController;   
ControlSet* controlset = new ControlSet(controls);                // controls is a Storage variable that contains the controls (from RRA)                 
controller->setControlSet(controlset);
osimModel->addController(controller);              // It crashes here
Do you know what I should do to avoid that Opensim crashes at the second time?

Thank you very much in advance,

Gil

Re: Controllers definition (memory issue?)

Posted: Wed Jul 01, 2015 11:05 pm
by jimmy
I have seen some issues in the past with dealing with Sets. Its a memory management thing when updated in the set. Try and trouble shoot by using some different methods, like updControlSet()