opensim-org / opensim-viewer-backend

Apache License 2.0
1 stars 0 forks source link

Unable to Convert .mot to .gltf File #6

Open yugzan opened 2 months ago

yugzan commented 2 months ago

I'm trying to use convertMotForce2Gltf.py to convert a .mot file to a .gltf file. However, when it executes timeSeriesTableVec3 = table.packVec3(), an issue arises:

Error -std::exception in 'OpenSim::TimeSeriesTable_< SimTK::Vec3 > OpenSim::TimeSeriesTable_< double >::packVec3()': Invalid Argument. Input DataTable must contain 3x number of columns. Thrown at DataTable.h:294 in DataTable_().

Is there an issue with the format of my .mot file? or any sample code can convert mot file to gltf

motfile01.mot

aymanhab commented 2 months ago

The mot file you provided does not have ground reaction forces (as the name of the method suggests) instead it contains coordinate values. Coordinates mean nothing without an underlying model so can't be visualized as is. There's an interface to pass a model and a list of mot files to generate the gltf file. If that's what you're looking for please let me know. Sorry for the sparse documentation as this is still work in progress but definitely would appreciate your feedback, experience using it.

yugzan commented 2 months ago

Thank you for your reply. I want to reproduce the functionality of animating a skeletons figure. I've trying to tests on converting TRC files (capturing several moving markers to GLTF) and OSIM files (displaying skeletons).

Therefore, based on what you mentioned, it seems I may require an interface that accepts OSIM files along with one or more MOT files. This way, I can obtain a GLTF file depicting the animated skeletons figure. Is this the right way?

============================================

Thank you. I think I've succeeded. I was able to pass the OSIM file and several MOT files into the gltf file using the viewport.py you provided.

https://github.com/opensim-org/opensim-viewer-backend/assets/6732974/afee37e6-a854-4820-a0d7-872508e51472