Open Okaerikoto opened 2 years ago
Oh yeah, this is an unfortunate wart in the current implementation.
Here's the issue: Nimble uses ASSIMP to load meshes, but ASSIMP doesn't support loading .vtp files currently. Fixing this is a bit obnoxious, since ASSIMP objects are passed around all over the place as the in-memory mesh object format, so adding another mesh loading library means writing a converted to ASSIMP format in-memory, or refactoring a bunch of code to use some other in-memory mesh format.
So, as a hack, when we see a .vtp file, we attempt to load a converted .ply file instead. If you look in the source at python/nimblephysics/models/rajagopal_data/Geometry/*
I've got a bunch of pre-converted files that have the extension *.vtp.ply
. Those should be bundled with the built pip install
wheels wherever your wheel is installed, so if they're not being bundled then that's a bug I need to investigate.
I'd also welcome a PR that lets us load .vtp files. We may actually want to refactor the internal mesh data structure to be something other than ASSIMP data, since there have now been a few features where that's the blocking design-flaw preventing an easy fix.
Then the problem is that I don't have the *.vtp.ply files.
For me, pip install nimblephysics
generated the following folder:
my_virtual_env/lib/python3.8/site-packages/nimblephysics/models
Containing only:
__init__.py
rajagopal.py
Since the folder rajagopal_data
was missing, I created it and downloaded the model from opensim website, which contains only the .vtp files. That's why I miss the .vtp.ply files.
Any idea why the folder rajagopal_data
is missing for me ?
I've had challenges with packaging the rajagopal_data
folder into the PyPI package in the past. Here's the models
folder you want to download into your my_virtual_env/lib/python3.8/site-packages/nimblephysics/models
: https://github.com/nimblephysics/nimblephysics/tree/master/python/nimblephysics/models
I'll try to go fix the packaging of the models into the Python wheel in the next few days.
Thanks for the help, I did that and I can load the model now.
@keenon are there any instructions for generating ply files if using a different set of vtp files? p.s. very nice work here!
I wrote a script to do that : vtp_to_ply.py
The command is python vtp_to_ply.py path/to/Geometry/
This lists all the .vtp and .obj contained in the Geometry folder and creates a folder path/to/Geometry_ply/
containing the .ply version of those files such that it can be loaded by nimble.
Note that you will have to rename Geometry_ply
to Geometry
for nimble to see it.
Thanks @MarilynKeller !
Environment
pip install nimblephysics
Current Behavior
In the .Rajagopal example, the skeleton model loading fails with the following errors (for each skeleton part):
The model .osim file do list the proper .vtp paths, and those files exist, but somehow the loader tries to load the files with the extension '.ply' .
Code to Reproduce
import nimblephysics as nimble skel: nimble.biomechanics.OpenSimFile = nimble.models.RajagopalHumanBodyModel()