Page 1 of 1

Rotate pelvis in myModel.osim in python

Posted: Tue Feb 08, 2022 7:49 am
by markuspeters
Hello,

I want to change the pelvis_rotation (coordinates window of OpenSim) of my model with my python script. Unfortunately I have no idea how to access the coordinate. The model should then be saved again with the new rotation. The documentation is very complex and unfortunately difficult to understand for me as a beginner.

I tried somethink like this...

myModel = osim.Model("MyModel.osim")
coordinates= myModel.getCoordinateSet()

Does not work for me. Can anybody help me out?

Best regards,

Markus


Edit:

I found a workaround. Just modify the .osim file in python and safe the new model!

Re: Rotate pelvis in myModel.osim in python

Posted: Wed Feb 09, 2022 9:16 am
by tkuchida
I want to change the pelvis_rotation (coordinates window of OpenSim) of my model with my python script. Unfortunately I have no idea how to access the coordinate. The model should then be saved again with the new rotation.
If you want to save the model with a new default pose (the pose of the model when you load it in the GUI), you can adjust the "default_value" property of the Coordinate(s) associated with the Joint (see https://simtk.org/api_docs/opensim/api_ ... afedc775ec) using the setDefaultValue() method (https://simtk.org/api_docs/opensim/api_ ... 2979fcf93c). Here's a Python example: https://github.com/opensim-org/opensim- ... on.py#L140.