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 » Thu Dec 14, 2017 10:52 am

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: 4150
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA
Contact:

Re: Hollow shapes

Post by Erwin Coumans » 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

ardabbour
Posts: 9
Joined: Fri Oct 06, 2017 8:42 am

Re: Hollow shapes

Post by ardabbour » Tue Jan 23, 2018 9:39 am

Thank you very much, this worked perfectly!

adamweshall
Posts: 3
Joined: Mon Apr 09, 2018 5:15 pm

Re: Hollow shapes

Post by adamweshall » Mon Apr 09, 2018 5:43 pm

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.

Post Reply