API Bug? JointSet not updated

Provide easy-to-use, extensible software for modeling, simulating, controlling, and analyzing the neuromusculoskeletal system.
POST REPLY
User avatar
Nicholas Dunbar
Posts: 5
Joined: Mon Feb 15, 2010 2:41 am

API Bug? JointSet not updated

Post by Nicholas Dunbar » Wed Sep 15, 2010 2:51 pm

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

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

RE: API Bug? JointSet not updated

Post by Ayman Habib » Wed Sep 15, 2010 2:57 pm

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

User avatar
Nicholas Dunbar
Posts: 5
Joined: Mon Feb 15, 2010 2:41 am

RE: API Bug? JointSet not updated

Post by Nicholas Dunbar » Wed Sep 15, 2010 3:13 pm


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

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

RE: API Bug? JointSet not updated

Post by Ayman Habib » Wed Sep 15, 2010 3:16 pm

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

POST REPLY