playback motion issue in Python
- Alessia Giordan
- Posts: 10
- Joined: Tue Jul 20, 2021 3:53 pm
playback motion issue in Python
Dear all,
I am working with Opensim API 4.2 in Python and I'd like to load and show an exisisting .mot motion file. I used the function showMotion(Model, TimeSeriesTable) (of VisualizerUtilities, see
https://simtk.org/api_docs/opensim/api_ ... e63984624b for more details), giving my model and the the TimeSeriesTable of my .mot file.
It seems to work, because it didn't give me any errors, but the visualizer window was empty, for all motion time. (see the attachments)
Does anyone know how to solve it?
ps: Using the IMUInverseKinematicsTool.run(true) method doesn't give me any errors.
Thank you for your time,
Alessia
The code is:
myModel = osim.Model('./OpenSense/' + modelFileName) # Load the model into the GUI
myModel.initSystem()
table = osim.TimeSeriesTable('./'+folder_name+'/IKResults/ik_'+root_name+'_orientations.mot')
print(table.getNumColumns())
print(table.getNumRows())
print(table.getColumnLabels())
timeVector = table.getIndependentColumn()
print(timeVector[2])
osim.VisualizerUtilities.showMotion(myModel, table)
I am working with Opensim API 4.2 in Python and I'd like to load and show an exisisting .mot motion file. I used the function showMotion(Model, TimeSeriesTable) (of VisualizerUtilities, see
https://simtk.org/api_docs/opensim/api_ ... e63984624b for more details), giving my model and the the TimeSeriesTable of my .mot file.
It seems to work, because it didn't give me any errors, but the visualizer window was empty, for all motion time. (see the attachments)
Does anyone know how to solve it?
ps: Using the IMUInverseKinematicsTool.run(true) method doesn't give me any errors.
Thank you for your time,
Alessia
The code is:
myModel = osim.Model('./OpenSense/' + modelFileName) # Load the model into the GUI
myModel.initSystem()
table = osim.TimeSeriesTable('./'+folder_name+'/IKResults/ik_'+root_name+'_orientations.mot')
print(table.getNumColumns())
print(table.getNumRows())
print(table.getColumnLabels())
timeVector = table.getIndependentColumn()
print(timeVector[2])
osim.VisualizerUtilities.showMotion(myModel, table)
- Attachments
-
- prompt.png (68.86 KiB) Viewed 1515 times
-
- visualizer.png (13.51 KiB) Viewed 1515 times
- Ayman Habib
- Posts: 2248
- Joined: Fri Apr 01, 2005 12:24 pm
Re: playback motion issue in Python
Hello,
As the messages point out the mesh files are not found and so are not shown. The solution is to call
and pass in the directory where the mesh files are located on your local machine before calling the showMotion method.
Please let us know how that goes,
-Ayman
As the messages point out the mesh files are not found and so are not shown. The solution is to call
Code: Select all
ModelVisualizer::addDirToGeometrySearchPaths(dir)
Please let us know how that goes,
-Ayman
- Alessia Giordan
- Posts: 10
- Joined: Tue Jul 20, 2021 3:53 pm
Re: playback motion issue in Python
Hi Ayman,
thank you for your reply. I tried what you said but it gives me the same issue. (there weren't the model and also the "ground and sky property" that is used as default)
Furthermore, when I tried to use the other function VisualizerUtilities::showModel(myModel) I got the same warning messages in the command prompt but the model was present in the Visualizer Window (see attachments).
Do you have any other suggestions?
I'd also like to change the default background property (set to "ground and sky" right now)
Thank for your time,
Alessia
thank you for your reply. I tried what you said but it gives me the same issue. (there weren't the model and also the "ground and sky property" that is used as default)
Furthermore, when I tried to use the other function VisualizerUtilities::showModel(myModel) I got the same warning messages in the command prompt but the model was present in the Visualizer Window (see attachments).
Do you have any other suggestions?
I'd also like to change the default background property (set to "ground and sky" right now)
Thank for your time,
Alessia
- Attachments
-
- dd.png (48.03 KiB) Viewed 1409 times
-
- c.png (39.35 KiB) Viewed 1409 times
- Ayman Habib
- Posts: 2248
- Joined: Fri Apr 01, 2005 12:24 pm
Re: playback motion issue in Python
Alessia,
As long as you're getting the messages about the missing vtp files I wouldn't be surprised that bones don't show up. The missing files refer to the bones of the hand so they are missing but the rest of the model is shown. There's no magic here, the order of serach paths is specified here:
https://simtk-confluence.stanford.edu/d ... references
There's a command line utility opensim_cmd included with OpenSim distributions that allows you to specify geometry-search-path, a model file and a motion file that you can try outside your python environment, without trying to reconstruct your specific settings. Not sure where you got your OpenSim distribution or if you're building your own or if you have multiple versions (in earlier versions we used OPENSIM_HOME to search for geometry mesh files so that may pollute the picture).
Hope this helps,
-Ayman
As long as you're getting the messages about the missing vtp files I wouldn't be surprised that bones don't show up. The missing files refer to the bones of the hand so they are missing but the rest of the model is shown. There's no magic here, the order of serach paths is specified here:
https://simtk-confluence.stanford.edu/d ... references
There's a command line utility opensim_cmd included with OpenSim distributions that allows you to specify geometry-search-path, a model file and a motion file that you can try outside your python environment, without trying to reconstruct your specific settings. Not sure where you got your OpenSim distribution or if you're building your own or if you have multiple versions (in earlier versions we used OPENSIM_HOME to search for geometry mesh files so that may pollute the picture).
Hope this helps,
-Ayman
- Alessia Giordan
- Posts: 10
- Joined: Tue Jul 20, 2021 3:53 pm
Re: playback motion issue in Python
Dear Ayman,
thanks for your reply. I have added the missing files in the Geometry folder and now there isn't no warning messages. However, the Visualizer window is still blank ...
Do you have any other tips to follow?
Thank you for your time.
Kindly,
Alessia
thanks for your reply. I have added the missing files in the Geometry folder and now there isn't no warning messages. However, the Visualizer window is still blank ...
Do you have any other tips to follow?
Thank you for your time.
Kindly,
Alessia
- Ayman Habib
- Posts: 2248
- Joined: Fri Apr 01, 2005 12:24 pm
Re: playback motion issue in Python
Hi Alessia,
To decouple python issues from other installation/environment issues I'd recommend to use the opensim-cmd utility which allows you to specify the model, geometry and trajectory on the command line (check the help and availability by typing
If that works then the issue is within your python setting/call-sequence, if not then we can reproduce it independently and you can file a bug and attach all the files to it and we'll investigate further. Keep in mind if you're using a plugin that it needs to be specified/loaded on the command line as well.
Hope this helps,
-Ayman
To decouple python issues from other installation/environment issues I'd recommend to use the opensim-cmd utility which allows you to specify the model, geometry and trajectory on the command line (check the help and availability by typing
Code: Select all
opensim-cmd viz -h
Hope this helps,
-Ayman
- Alessia Giordan
- Posts: 10
- Joined: Tue Jul 20, 2021 3:53 pm
Re: playback motion issue in Python
Dear Ayman,
thanks for your help.
I got the same error typing this line in the command prompt:
opensim-cmd viz model ScapulothorachicJoint_Shoulder.osim ik_XSENS_04_02_2022_11_54_04_orientations.mot
Hoping there is a solution, I attach all the files. https://drive.google.com/drive/folders/ ... sp=sharing
Thanks for your time.
Kindly,
Alessia Giordan
thanks for your help.
I got the same error typing this line in the command prompt:
opensim-cmd viz model ScapulothorachicJoint_Shoulder.osim ik_XSENS_04_02_2022_11_54_04_orientations.mot
Hoping there is a solution, I attach all the files. https://drive.google.com/drive/folders/ ... sp=sharing
Thanks for your time.
Kindly,
Alessia Giordan
- Alessia Giordan
- Posts: 10
- Joined: Tue Jul 20, 2021 3:53 pm
Re: playback motion issue in Python
Hi,
Is there any news about this issue? Thank you
Alessia
Is there any news about this issue? Thank you
Alessia
- Alessia Giordan
- Posts: 10
- Joined: Tue Jul 20, 2021 3:53 pm
Re: playback motion issue in Python
Hi,
Is there any news about this issue on playback motion window? Thank you for your time.
Alessia
Is there any news about this issue on playback motion window? Thank you for your time.
Alessia