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
API Bug? JointSet not updated
- Ayman Habib
- Posts: 2252
- Joined: Fri Apr 01, 2005 12:24 pm
RE: API Bug? JointSet not updated
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
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
- Nicholas Dunbar
- Posts: 5
- Joined: Mon Feb 15, 2010 2:41 am
RE: API Bug? JointSet not updated
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
- Ayman Habib
- Posts: 2252
- Joined: Fri Apr 01, 2005 12:24 pm
RE: API Bug? JointSet not updated
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
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