Skip to content

Commit 7e6ca05

Browse files
authored
Using Bullet as a Collision Checker (#337)
* Adding Bullet collision tutorial: * use copy of visualizing collisions tutorial * adapted copied tutorial for Bullet * added CCD demonstration to tutorial * PR review fix * clang-format and update broken link * update robot state and maker visualizations * Replace raw pointers through smart pointers * Retriggering travis * fix compiler warnings * fix clang-tidy * Fixup
1 parent 9a25cf0 commit 7e6ca05

12 files changed

Lines changed: 717 additions & 0 deletions

CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,3 +72,4 @@ add_subdirectory(doc/creating_moveit_plugins/lerp_motion_planner)
7272
add_subdirectory(doc/moveit_cpp)
7373
add_subdirectory(doc/collision_environments)
7474
add_subdirectory(doc/visualizing_collisions)
75+
add_subdirectory(doc/bullet_collision_checker)
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
add_executable(bullet_collision_checker_tutorial
2+
src/bullet_collision_checker_tutorial.cpp)
3+
4+
target_link_libraries(bullet_collision_checker_tutorial
5+
${interactive_markers_LIBRARIES}
6+
interactivity_utils
7+
${catkin_LIBRARIES}
8+
${Boost_LIBRARIES})
9+
10+
install(TARGETS bullet_collision_checker_tutorial
11+
DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION})
12+
13+
install(DIRECTORY launch DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION})
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
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.
177 KB
Loading
114 KB
Loading
116 KB
Loading
123 KB
Loading
86.9 KB
Loading
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<launch>
2+
3+
<!-- load URDF -->
4+
<param name="robot_description" command="$(find xacro)/xacro --inorder '$(find franka_description)/robots/panda_arm_hand.urdf.xacro'"/>
5+
6+
<!-- load SRDF -->
7+
<param name="robot_description_semantic" command="$(find xacro)/xacro --inorder '$(find panda_moveit_config)/config/panda_arm_hand.srdf.xacro'"/>
8+
9+
<!-- Run RViz with a custom config -->
10+
<node name="$(anon rviz)" pkg="rviz" type="rviz" respawn="false" args="-d $(find moveit_tutorials)/doc/bullet_collision_checker/launch/moveit.rviz" output="screen">
11+
<rosparam command="load" file="$(find panda_moveit_config)/config/kinematics.yaml"/>
12+
</node>
13+
14+
<!-- If needed, broadcast static tf2 for robot root -->
15+
<node pkg="tf2_ros" type="static_transform_publisher" name="virtual_joint_broadcaster_0" args="0 0 0 0 0 1 /world/panda_link0 /panda_link0 10" />
16+
17+
<!-- launch interactivity_tutorial -->
18+
<node name="bullet_collision_tutorial" pkg="moveit_tutorials" type="bullet_collision_checker_tutorial" respawn="false" output="screen">
19+
<rosparam command="load" file="$(find panda_moveit_config)/config/kinematics.yaml"/>
20+
</node>
21+
22+
</launch>

0 commit comments

Comments
 (0)