Given a (potentially nasty, nonconvex) mesh, automatically creates an SDF file that describes that object. The visual geometry is pointed to the input mesh, and the collision geometry is pointed to a convex decomposition of the input mesh (as performed by trimesh and vhacd.
This has been designed to interoperate well with Drake, but doesn’t strictly need it.
For just basic conversion:
argparse lxml numpy trimesh
and you need
testVHACD on your
PATH. I use to get it.
The visualization utility requires Drake.
To perform the conversion (here, on an example mesh with a 1000x downscaling):
python generate_sdf_from_mesh.py test_data/bowl_6p25in.obj --scale 0.001 --preview
If you have Drake installed, you can inspect the resulting SDF (use the menu at the right to show/hide the visual and collision mesh components):
python inspect_sdf_in_meshcat.py test_data/bowl_6p25in.sdf
Both can be invoked with
--help to see additional arguments.