Page 1 of 1

API Bug? JointSet not updated

Posted: Wed Sep 15, 2010 2:51 pm
by ndunbar
Hello OpenSim Developers and Community,

I am currently working with the OpenSim API.

I can successfully import a .osim file and extract the body names from Model.getBodySet.getName() where i is an int to loop through all bodies.

However the same paradigm does not work for Model.getJointSet.getName(). The joint set will return zero number of joints (also seen with Model.printBasicInfo), however if I open this exact model (BothLegs.osim) using the OpenSim GUI, the tree list indicates 13 joints for the model.

Where are these joint names stored in the Model class? Are they accessible?

I would be glad to provide more detail about this problem as needed.

Thank you for your time,

Nick Dunbar
University of Florida
Orthopedic Biomechanics Lab

RE: API Bug? JointSet not updated

Posted: Wed Sep 15, 2010 2:57 pm
by aymanh
Hi Nick,

Did you make the call to model.initSystem()? Before this call the actual Joints were not created and may not be accessible. The GUI calls initSystem on the model after it is constructed and before displaying it.

Hope this helps,
-Ayman

RE: API Bug? JointSet not updated

Posted: Wed Sep 15, 2010 3:13 pm
by ndunbar

Hi Ayman,

Thank you for your quick response! The joints were generated after a call to Model.initSystem() just as you suggested.

As a follow up question, if I make changes to the model after initialization and can I simply reinitialize and overwrite the State object?

Thanks,
Nick Dunbar

RE: API Bug? JointSet not updated

Posted: Wed Sep 15, 2010 3:16 pm
by aymanh
Nick,

Sure, that's the idea. Just keep in mind that in C++ you can't reinitialize a "reference" so you may need to create a fresh variable to contain the new state.

Good luck,
-Ayman