|
| 1 | +Using Bullet for Collision Checking |
| 2 | +=================================== |
| 3 | + |
| 4 | +.. image:: images/bullet_collision_visualized.png |
| 5 | + :width: 600px |
| 6 | + |
| 7 | +In addition to the Flexible Collision Library (FCL), `Bullet Collision Detection <https://pybullet.org/wordpress/>`_ is available as a collision checker. The tutorial builds on top of the `Visualizing Collisions <../visualizing_collisions/visualizing_collisions_tutorial.html>`_ tutorial to show collisions. |
| 8 | + |
| 9 | +Furthermore, Continuous Collision Detection (CCD) is available and demonstrated with Bullet. |
| 10 | + |
| 11 | +Getting Started |
| 12 | +--------------- |
| 13 | +If you haven't already done so, make sure you've completed the steps in `Getting Started <../getting_started/getting_started.html>`_. |
| 14 | + |
| 15 | +Running the Code |
| 16 | +---------------- |
| 17 | +Roslaunch the launch file to run the code directly from moveit_tutorials: :: |
| 18 | + |
| 19 | + roslaunch moveit_tutorials bullet_collision_checker_tutorial.launch |
| 20 | + |
| 21 | +You should now see the Panda robot and a box both with interactive markers which you can drag around. Note that different to FCL, Bullet does not calculate all individual contact points for a shape but only the point of deepest penetration. |
| 22 | + |
| 23 | +.. figure:: images/fcl_vs_bullet_markers.png |
| 24 | + |
| 25 | + .. |
| 26 | +
|
| 27 | + Left: FCL collision results. Right: Bullet collision results. |
| 28 | + |
| 29 | +Please note that the current implementation of Bullet as a collision detector is not thread safe as the internal collision managers are mutable members. |
| 30 | + |
| 31 | +Continuous Collision Detection |
| 32 | +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 33 | + |
| 34 | +Additionally, Bullet has continuous collision capabilities. This means that it can be guaranteed that no collision occurs during the transition between two discrete robot states with the environment. To get a demonstration of the CCD click the ``Next`` button of the ``moveit_visual_tools`` panel on the bottom left in RViz. The interactive robot disappears and the robot appears in a state where its hand is just behind a box. On pressing next again, the robot jumps to a configuration where the hand is right in front of the box. In both states, no collision is detected (see terminal output). |
| 35 | + |
| 36 | +.. figure:: images/bullet_CCD_discrete.png |
| 37 | + |
| 38 | + .. |
| 39 | +
|
| 40 | + Left: robot in configuration 1. Right: robot in configuration 2. |
| 41 | + |
| 42 | +On a following ``Next``, CCD is performed using a casted robot model between the two discrete poses. A collision is reported |
| 43 | +(see terminal output for details). |
| 44 | + |
| 45 | +.. image:: images/bullet_CCD_both_states.png |
| 46 | + :width: 600px |
| 47 | + |
| 48 | +Pressing ``Next`` one more time finishes the tutorial. |
| 49 | + |
| 50 | +Relevant Code |
| 51 | +------------- |
| 52 | +The entire code can be seen :codedir:`here <bullet_collision_checker>` in the moveit_tutorials GitHub project. A lot of information necessary for understanding how this demo works is left out to keep this tutorial focused on Bullet. Please see `Visualizing Collisions <../visualizing_collisions/visualizing_collisions_tutorial.html>`_ for code explanation regarding the visualizing of the collisions. |
| 53 | + |
| 54 | +.. tutorial-formatter:: ./src/bullet_collision_checker_tutorial.cpp |
| 55 | + |
| 56 | +Launch file |
| 57 | +----------- |
| 58 | +The entire launch file is :codedir:`here <bullet_collision_checker>` on GitHub. All the code in this tutorial can be compiled and run from the ``moveit_tutorials`` package. |
0 commit comments