Page 1 of 1

Hollow shapes

Posted: Thu Dec 14, 2017 10:52 am
by ardabbour
Hello, I'm trying to detect collision between shapes that can be placed within each other. I created a hollow shape and its filling in SolidWorks, then exported them to URDF format using the popular ROS addon for this job. The STL file used for the mesh is correct and representative of the hollowness of the shape, but the mesh produced in the physics simulation is not really hollow when I use the simple p.loadURDF method. Is there a way to represent hollow 3D shapes?

EDIT: I figured out that if we import shapes as .obj files using the createCollisionShape method and the GEOM_FORCE_CONCAVE_TRIMESH flag, we can represent the shapes correctly. Now the problem is that this is valid only for non-movable objects (as per the pybullet quickstart guide), and I cannot detect collision between two objects whose meshes are made of concave triangles. Does anyone know how to (if possible) detect collision and penetration depth between two moving concave objects?

Re: Hollow shapes

Posted: Wed Jan 03, 2018 5:06 pm
by Erwin Coumans
Yes, you can create a convex decomposition of the object, using HACD. The duck and teddy bear URDF files are examples of this.

https://github.com/bulletphysics/bullet ... vhacd.urdf
https://github.com/bulletphysics/bullet ... vhacd.urdf

The test_vhacd executable can do this conversion.

Use premake to build Bullet from source to get this binary:
git clone https://github.com/bulletphysics/bullet3
cd bullet3/build3
./premake4_osx gmake
cd gmake
make test_vhacd
../../bin/test_vhacd_gmake_x64_release

Re: Hollow shapes

Posted: Tue Jan 23, 2018 9:39 am
by ardabbour
Thank you very much, this worked perfectly!

Re: Hollow shapes

Posted: Mon Apr 09, 2018 5:43 pm
by adamweshall
I did a similar thing using this plugin for blender

https://github.com/kmammou/v-hacd

However, I found pybullet still applied a bounding box to the mesh that was produced anyways. I had to save a number of individual meshes (as STL files) and then add multiple collision geometries to one link.

Or maybe it didn't work because I was using STL file? Should I be using .obj files?

Edit: I think I may have answered my own question. Using a .obj seems work better than using multiple STLs.

Re: Hollow shapes

Posted: Mon Feb 03, 2020 6:18 pm
by Alireza
Erwin Coumans wrote: Wed Jan 03, 2018 5:06 pm Yes, you can create a convex decomposition of the object, using HACD. The duck and teddy bear URDF files are examples of this.

https://github.com/bulletphysics/bullet ... vhacd.urdf
https://github.com/bulletphysics/bullet ... vhacd.urdf

The test_vhacd executable can do this conversion.

Use premake to build Bullet from source to get this binary:
git clone https://github.com/bulletphysics/bullet3
cd bullet3/build3
./premake4_osx gmake
cd gmake
make test_vhacd
../../bin/test_vhacd_gmake_x64_release

So when we do the decomposition of a concave stl file with vhacd, we will be left with one obj file in the end that we load inside the urdf right? or for each decomposed convex mesh we should get a separate obj file that we load each differently?

Re: Hollow shapes

Posted: Fri Feb 21, 2020 9:01 pm
by bullet_team
It can be 1 obj file that has multiple convex parts. That's how the vhacd util works.

See for example this file:
https://github.com/bulletphysics/bullet ... CD_CHs.obj

Each convex object is marked with 'o'