Page 1 of 1
playback motion issue in Python
Posted: Wed Feb 02, 2022 6:11 am
by alessiag
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)
Re: playback motion issue in Python
Posted: Thu Feb 03, 2022 11:49 am
by aymanh
Hello,
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)
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
Re: playback motion issue in Python
Posted: Fri Feb 04, 2022 8:26 am
by alessiag
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
Re: playback motion issue in Python
Posted: Fri Feb 04, 2022 12:15 pm
by aymanh
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
Re: playback motion issue in Python
Posted: Tue Feb 08, 2022 10:01 am
by alessiag
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
Re: playback motion issue in Python
Posted: Tue Feb 08, 2022 10:26 am
by aymanh
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
Re: playback motion issue in Python
Posted: Wed Feb 09, 2022 2:02 am
by alessiag
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
Re: playback motion issue in Python
Posted: Mon Feb 21, 2022 5:25 am
by alessiag
Hi,
Is there any news about this issue? Thank you
Alessia
Re: playback motion issue in Python
Posted: Mon Apr 04, 2022 7:47 am
by alessiag
Hi,
Is there any news about this issue on playback motion window? Thank you for your time.
Alessia