How to disable collisions?

Official Python bindings with a focus on reinforcement learning and robotics.
Post Reply
Senpid Sinclair
Posts: 1
Joined: Fri May 04, 2018 7:21 pm

How to disable collisions?

Post by Senpid Sinclair » Fri Jul 20, 2018 11:04 am

I know that collision detection/avoidance is what bullet is all about but I really just want to use it as a visualizer for robot stuff (like rviz but without ros) because it is very easy to setup.

So far for testing I am just loading robots via the URDF loader and they are going crazy when spawned into each other.

Now my question is: How can I either:
a) globally disable collisions or
b) disable collisions per object?

In another thread I found someone recommending setting a flag `CF_NO_CONTACT_RESPONSE` in the C++ code, but I haven't found that one in the pybullet lib and wouldn't know how to apply this. I was hoping that the URDF loader has this somehow as an optional flag, but not from what I saw.

Thanks so much in advance.

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

Re: How to disable collisions?

Post by ardabbour » Mon Sep 03, 2018 11:35 am

You can use visual shapes without collision shapes. For example, your URDF code can be:

Code: Select all

<?xml version="1.0"?>
<robot name="cube">
  <link name="base_link">

        <box size="0 0 0"/>

      <mass value="0"/>
    	<inertia ixx="0" ixy="0" ixz="0" iyy="0" iyz="0" izz="0"/>

        <box size="1 1 1"/>


User avatar
Erwin Coumans
Site Admin
Posts: 4110
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA

Re: How to disable collisions?

Post by Erwin Coumans » Thu Sep 13, 2018 3:32 am

I just implemented a few ways to do it:

Disable collisions per object pair / link:

Code: Select all

enableCollision= 0
pybullet.setCollisionFilterPair(objectUniqueIdA, objectUniqueIdB, linkIndexA, linkIndexB, enableCollision)
or disable collisions per group of objects:

Code: Select all

group = 0#other objects don't collide with me
mask=0 # don't collide with any other object
pybullet. setCollisionFilterGroupMask(objectUniqueId, linkIndex, group, mask)

Post Reply