Hollow shapes

Official Python bindings with a focus on reinforcement learning and robotics.
Post Reply
ardabbour
Posts: 9
Joined: Fri Oct 06, 2017 8:42 am

Hollow shapes

Post 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?
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA
Contact:

Re: Hollow shapes

Post 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
ardabbour
Posts: 9
Joined: Fri Oct 06, 2017 8:42 am

Re: Hollow shapes

Post by ardabbour »

Thank you very much, this worked perfectly!
adamweshall
Posts: 3
Joined: Mon Apr 09, 2018 5:15 pm

Re: Hollow shapes

Post 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.
Alireza
Posts: 2
Joined: Thu Jan 30, 2020 2:33 pm

Re: Hollow shapes

Post 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?
bullet_team
Posts: 21
Joined: Mon Oct 28, 2013 12:18 am

Re: Hollow shapes

Post 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'
Post Reply