RussTedrake / manipulation

Course notes for MIT manipulation class
BSD 3-Clause "New" or "Revised" License
407 stars 119 forks source link

Add script for creating an SDFormat file for a triangle mesh #254

Closed nepfaff closed 10 months ago

nepfaff commented 11 months ago

I have tested it using the YCB Mustard Bottle, and it produces beautifully formatted SDFormat files.

I was initially sceptical about computing inertia with trimesh for non-watertight meshes but the resulting values are often reasonable in practice. I evaluated this by comparing the values for trimesh, drake, and my theoretically more robust sampling-based method and found them to be very similar for most cases of interest.

~The current implementation requires trimesh<=3.23.5. I'm planning to make it work for later versions of trimesh but getting the PR through for this might take a while. See https://github.com/mikedh/trimesh/issues/2045 for progress on this.~


This change is Reviewable

nepfaff commented 10 months ago

While writing the unit test, I realized that the user will need to install vhacd using the following script:

#!/bin/bash
set -xe

# Set the installation path.
VHACD_PATH=/usr/local/bin/testVHACD

# Grab the VHACD (convex segmenter) binary.
wget https://github.com/mikedh/v-hacd-1/raw/master/bin/linux/testVHACD -O "${VHACD_PATH}" -nv

# Check the hash of the downloaded file
echo "e1e79b2c1b274a39950ffc48807ecb0c81a2192e7d0993c686da90bd33985130  ${VHACD_PATH}" | sha256sum --check

# Make it executable.
chmod +x ${VHACD_PATH}

The best place to put this seems to be setup. However, the functionality would not be accessible with a simple pip install. Installing vhacd manually will no longer be necessary once this lands (probably available with pip in 1-3 weeks).

RussTedrake commented 10 months ago

looks like your upstream PR has merged. and there are some pip wheels. should we upgrade to them? or wait for pypi?

nepfaff commented 10 months ago

looks like your upstream PR has merged. and there are some pip wheels. should we upgrade to them? or wait for pypi?

Isn't it on one of the development branches right now? If the pip wheels are accessible, then we can switch to the new version and merge.

Based on my last comment about manual VHACD installation, we will want to switch to the new version anyway to avoid this and then merge later if necessary. afc09df adds these changes. The current trimesh version requirements no longer work and we would need to link the dev pip wheel.

nepfaff commented 10 months ago

The current version now requires a local trimesh build of this branch. Checking out that branch and running pip install . should work.

I have a test case, but it will only work once we fix the specified trimesh requirement (once the pypi wheels have been published).