Rotate pelvis in myModel.osim in python

Provide easy-to-use, extensible software for modeling, simulating, controlling, and analyzing the neuromusculoskeletal system.
POST REPLY
User avatar
Markus Peters
Posts: 1
Joined: Thu Oct 14, 2021 4:06 am

Rotate pelvis in myModel.osim in python

Post by Markus Peters » Tue Feb 08, 2022 7:49 am

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!

Tags:

User avatar
Thomas Uchida
Posts: 1794
Joined: Wed May 16, 2012 11:40 am

Re: Rotate pelvis in myModel.osim in python

Post by Thomas Uchida » Wed Feb 09, 2022 9:16 am

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.

POST REPLY