OpenSim2.2.0 API "isConstrained()" error

Provide easy-to-use, extensible software for modeling, simulating, controlling, and analyzing the neuromusculoskeletal system.
POST REPLY
User avatar
Marc Carmichael
Posts: 45
Joined: Thu Jul 16, 2009 2:50 am

OpenSim2.2.0 API "isConstrained()" error

Post by Marc Carmichael » Sun Nov 28, 2010 11:51 pm

Hi, I have upgraded to 2.2.0 and I am having a segmentation fault. I wrote a matlab mex function for get model data from OpenSim. Now when I link to the new libraries I get a segmentation fault when I run the function:

if (osimModel.getCoordinateSet().get(0).isConstrained() == 0)
{
...
}

The isConstrained function seems to be at fault, although comparing the doxygen documentation there appears to be no change. Can anyone share some light on this? It was working previously on version 2.0.2.


Also, out of interest I noticed the Model::getGravity() function has been changed so now it returns a vector instead of requiring a reference to one, is there a reason for this?

Marc

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

RE: OpenSim2.2.0 API "isConstrained()" error

Post by Ayman Habib » Mon Nov 29, 2010 2:30 am

Hi Marc,

Can you check the size of the CoordinateSet? Could it be that the model is being used before it's initialized (using initSystem()) so the set is of size 0? The method isConstrained still exists in the Coordinate class so I don't think it's the culprit (the problem is probably upstream of this call).

For the gravity, either a const reference or a copy would do the trick. What we don't want is leaking a non-const reference to the gravity vector and allowing users to change it without calling Model::setGravity since the Gravity Force will not be adjusted properly.

Hope this helps, and please let me know your findings regarding the "isConstrained()" call.

Cheers,
-Ayman

POST REPLY