Controllers definition (memory issue?)

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

Controllers definition (memory issue?)

Post by Gil SerrancolĂ­ » Tue Jun 23, 2015 8:11 am

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

User avatar
jimmy d
Posts: 1375
Joined: Thu Oct 04, 2007 11:51 pm

Re: Controllers definition (memory issue?)

Post by jimmy d » Wed Jul 01, 2015 11:05 pm

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()

POST REPLY