New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adding Bullet and Tesseract into MoveIt #1504
Adding Bullet and Tesseract into MoveIt #1504
Conversation
9dd093c
to
c155118
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've done a very quick first pass on this PR. There are a lot of other style things that we should tackle after a first functionality pass is through. In general, look for places where we can use MoveIt structures instead of bringing in new tesseract structs internal to the collision managers.
moveit_core/collision_detection/include/moveit/collision_detection/collision_common.h
Outdated
Show resolved
Hide resolved
moveit_core/collision_detection/include/moveit/collision_detection/collision_common.h
Outdated
Show resolved
Hide resolved
...core/collision_detection_bullet/include/moveit/collision_detection_bullet/collision_common.h
Show resolved
Hide resolved
...re/collision_detection_bullet/include/moveit/collision_detection_bullet/collision_robot_bt.h
Outdated
Show resolved
Hide resolved
...collision_detection_bullet/include/moveit/collision_detection_bullet/tesseract/basic_types.h
Outdated
Show resolved
Hide resolved
...collision_detection_bullet/include/moveit/collision_detection_bullet/tesseract/basic_types.h
Outdated
Show resolved
Hide resolved
...tion_bullet/include/moveit/collision_detection_bullet/tesseract/bullet_cast_simple_manager.h
Outdated
Show resolved
Hide resolved
...core/collision_detection_bullet/include/moveit/collision_detection_bullet/tesseract/macros.h
Outdated
Show resolved
Hide resolved
0577b4b
to
4797bc4
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(Sorry, I though I submitted this review sometime yesterday)
moveit_core/collision_detection/include/moveit/collision_detection/collision_common.h
Outdated
Show resolved
Hide resolved
moveit_core/collision_detection/include/moveit/collision_detection/collision_common.h
Outdated
Show resolved
Hide resolved
...re/collision_detection_bullet/include/moveit/collision_detection_bullet/collision_world_bt.h
Outdated
Show resolved
Hide resolved
...ollision_detection_bullet/include/moveit/collision_detection_bullet/tesseract/bullet_utils.h
Outdated
Show resolved
Hide resolved
...ollision_detection_bullet/include/moveit/collision_detection_bullet/tesseract/bullet_utils.h
Outdated
Show resolved
Hide resolved
..._detection_fcl/include/moveit/collision_detection_fcl/collision_detector_fcl_plugin_loader.h
Outdated
Show resolved
Hide resolved
moveit_core/collision_detection_bullet/src/tesseract/bullet_cast_bvh_manager.cpp
Outdated
Show resolved
Hide resolved
moveit_core/collision_detection_bullet/src/tesseract/bullet_cast_bvh_manager.cpp
Outdated
Show resolved
Hide resolved
moveit_core/collision_detection_bullet/src/tesseract/bullet_discrete_bvh_manager.cpp
Outdated
Show resolved
Hide resolved
moveit_core/collision_detection_bullet/test/test_bt_collision_detection.cpp
Outdated
Show resolved
Hide resolved
6fd7094
to
7062244
Compare
43b0d5c
to
3ab813e
Compare
This is close to being ready, the last big thing that I'd suggest is to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Few more changes/some open questions for review
...t_ros/planning/planning_components_tools/src/compare_collision_speed_checking_fcl_bullet.cpp
Outdated
Show resolved
Hide resolved
...t_ros/planning/planning_components_tools/src/compare_collision_speed_checking_fcl_bullet.cpp
Outdated
Show resolved
Hide resolved
moveit_core/collision_detection/include/moveit/collision_detection/collision_common.h
Outdated
Show resolved
Hide resolved
...re/collision_detection_bullet/include/moveit/collision_detection_bullet/collision_robot_bt.h
Outdated
Show resolved
Hide resolved
...collision_detection_bullet/include/moveit/collision_detection_bullet/tesseract/basic_types.h
Outdated
Show resolved
Hide resolved
...tection_bullet/include/moveit/collision_detection_bullet/tesseract/bullet_cast_bvh_manager.h
Outdated
Show resolved
Hide resolved
...tection_bullet/include/moveit/collision_detection_bullet/tesseract/bullet_cast_bvh_manager.h
Outdated
Show resolved
Hide resolved
2d46eb5
to
fd1c53f
Compare
607fc77
to
8cca933
Compare
9c4f2a5
to
01fdb79
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In general I approve this as well. I have the same remark as Dave: Try to replace tesseract with moveit wherever possible, particularly in header guards.
There are (still) several instances, where you write bt instead of bullet. As you seem to have decided for the latter, go for it consequently ;-)
moveit_core/collision_detection/include/moveit/collision_detection/collision_common.h
Outdated
Show resolved
Hide resolved
moveit_core/collision_detection/include/moveit/collision_detection/test_collision_common.h
Show resolved
Hide resolved
...collision_detection_bullet/include/moveit/collision_detection_bullet/tesseract/basic_types.h
Outdated
Show resolved
Hide resolved
{ | ||
} | ||
|
||
const std::vector<std::string>& active; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clang-tidy --fix
does this automatically. And yes, you should adapt all MoveIt code, otherwise Travis will complain anyway.
const std::vector<std::string>& active; | ||
|
||
/** \brief If after a positive broadphase check the distance is below this threshold, a contact is added. */ | ||
const double& contact_distance; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this be called broadphase_threshold
then (according to the comment)?
A contact should only be added if there is a real contact...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, this is not the broadphase threshold (which is another parameter specific to each collision object). For a broadphase candidate pair, their distance is calculated and if its below the contact_distance
the distance and all other information is added as a result. In Bullet this is regarded as a contact. Note that contact does not necessarily refer to a real contact (distance < 0 is possible).
Contrary to FCL, Bullet does not make a difference between distance and collision requests which in my opinion is the cleaner solution with less duplicate code (the FCL MoveIt implementation has plenty of duplicate code because of this distinction). In Bullet, distance requests are simply treated as contacts with the only difference that the contact depth/distance is positive. So a contact is not necessarily a real collision. This wording is used throughout the Bullet Library.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I get you correct, Bullet performs the detailed collision/distance check only if the broadphase check passed. So, if two objects fail the broadphase check (e.g. because they are nicely aligned and their axes-aligned bounding boxes don't overlap), their distance will not be reported?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, they won't. But you can easily expand the AABB of each object by a distance (this is a parameter) and then they will be reported. So I could expand each AABB by 5 cm and then I will get for sure all objects which are closer than 5 cm and their respective distance.
moveit_core/collision_detection_bullet/test/test_bt_collision_detection_panda.cpp
Outdated
Show resolved
Hide resolved
* adapting variable names * license match MoveIt style * added ToDos
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the additional improvements! Some small remarks remain.
...collision_detection_bullet/include/moveit/collision_detection_bullet/tesseract/basic_types.h
Outdated
Show resolved
Hide resolved
Excited to seeing this close to ready! Travis is still unhappy... |
* renaming COW to CollisionObjectWrapper * adding documentation
Only kinetic is now failing (it does not need to pass, right?), the three other builds pass 🎉 |
Looks like Kinetic/Xenial ships with an older Bullet version. I suggest dropping Kinetic support for now. |
Moving this convo here: #1570 |
Ping |
Thanks for reviewing, next up is #1551 for the continuous collision checking. |
* Added discrete BVH Bullet manager * Added continuous collision detection * Cleanup of tesseract code * removed simple collision managers * changed enum to enum classes * fixed typos * removing debugging statements * removing tesseract allowed collision matrix * removed tesseract macros * replaced typedefs of stl containers * removed tesseract attached object code * ACM members of collision robot and world removed and ACM check into callback out of class * remove ContactTestType and replace through MoveIt CollisionRequest * BodyType int changed to enum * removed tesseract_msgs dependency and unnecessary tesseract code * changed dependency from bullet3_ros to debian Bullet package * Adding bullet and tesseract simple collision manager to the template: * added benchmark case for checking collision speed * tests for bullet collision checking * Adding missing features: * attached objects * contact reporting max number of contacts fixed * Bullet plugin xml name fixed * padding and scaling for robot added * updated tests
* Added discrete BVH Bullet manager * Added continuous collision detection * Cleanup of tesseract code * removed simple collision managers * changed enum to enum classes * fixed typos * removing debugging statements * removing tesseract allowed collision matrix * removed tesseract macros * replaced typedefs of stl containers * removed tesseract attached object code * ACM members of collision robot and world removed and ACM check into callback out of class * remove ContactTestType and replace through MoveIt CollisionRequest * BodyType int changed to enum * removed tesseract_msgs dependency and unnecessary tesseract code * changed dependency from bullet3_ros to debian Bullet package * Adding bullet and tesseract simple collision manager to the template: * added benchmark case for checking collision speed * tests for bullet collision checking * Adding missing features: * attached objects * contact reporting max number of contacts fixed * Bullet plugin xml name fixed * padding and scaling for robot added * updated tests
* Added discrete BVH Bullet manager * Added continuous collision detection * Cleanup of tesseract code * removed simple collision managers * changed enum to enum classes * fixed typos * removing debugging statements * removing tesseract allowed collision matrix * removed tesseract macros * replaced typedefs of stl containers * removed tesseract attached object code * ACM members of collision robot and world removed and ACM check into callback out of class * remove ContactTestType and replace through MoveIt CollisionRequest * BodyType int changed to enum * removed tesseract_msgs dependency and unnecessary tesseract code * changed dependency from bullet3_ros to debian Bullet package * Adding bullet and tesseract simple collision manager to the template: * added benchmark case for checking collision speed * tests for bullet collision checking * Adding missing features: * attached objects * contact reporting max number of contacts fixed * Bullet plugin xml name fixed * padding and scaling for robot added * updated tests
* Added discrete BVH Bullet manager * Added continuous collision detection * Cleanup of tesseract code * removed simple collision managers * changed enum to enum classes * fixed typos * removing debugging statements * removing tesseract allowed collision matrix * removed tesseract macros * replaced typedefs of stl containers * removed tesseract attached object code * ACM members of collision robot and world removed and ACM check into callback out of class * remove ContactTestType and replace through MoveIt CollisionRequest * BodyType int changed to enum * removed tesseract_msgs dependency and unnecessary tesseract code * changed dependency from bullet3_ros to debian Bullet package * Adding bullet and tesseract simple collision manager to the template: * added benchmark case for checking collision speed * tests for bullet collision checking * Adding missing features: * attached objects * contact reporting max number of contacts fixed * Bullet plugin xml name fixed * padding and scaling for robot added * updated tests
* Empty collision checker template for usage with tesseract and bullet (#1499) * Adding documentation to collision detection (#1488) * CMake adaptions for Tesseract integration * Empty collision detector template for tesseract and bullet * Making bullet as a collision plugin available * Adding missing error messages * Adding new folders and libraries to cmake * Fixing the BSD license * clang-format * Generic collision detection test suite (#1543) Generalize collision detection tests by using a templated test fixture. * Bullet Collision Detection (#1504) * Added discrete BVH Bullet manager * Added continuous collision detection * Cleanup of tesseract code * removed simple collision managers * changed enum to enum classes * fixed typos * removing debugging statements * removing tesseract allowed collision matrix * removed tesseract macros * replaced typedefs of stl containers * removed tesseract attached object code * ACM members of collision robot and world removed and ACM check into callback out of class * remove ContactTestType and replace through MoveIt CollisionRequest * BodyType int changed to enum * removed tesseract_msgs dependency and unnecessary tesseract code * changed dependency from bullet3_ros to debian Bullet package * Adding bullet and tesseract simple collision manager to the template: * added benchmark case for checking collision speed * tests for bullet collision checking * Adding missing features: * attached objects * contact reporting max number of contacts fixed * Bullet plugin xml name fixed * padding and scaling for robot added * updated tests * Adding continuous collision detection to Bullet (#1551) * Adding continous collision detection: * check only active links added * benchmark FCL vs Bullet * renaming files from bt to bullet * renaming variables from bt to bullet * clang-tidy and clang-format * renaming of variables to be in moveit format * continuous tests added * CCD active links changed * distance testing added to panda test suite * New collision features: * broadphase early culling * minimal distance reporting * renaming collision filter and group * removed extra margin on AABB for bullet * ACM in test from SRDF * PR review * Unified Collision Environment Bullet (#1572) * Templated tests adapted for unified collision env * Unified Bullet collision environment: * broadphase filtering adapted for early culling * ACM from SRDF in test * cleanup for bullet single collision env * removed link2castcow for CCD and only use constructor of COW directly * parent class for collision managers * removed function pointer for ACM check * removed extra self-collision manager and use only single manager * speed benchmark for unified environment * PR review: * more descriptive variable names * added user to TODO * PR review: * shortening namespace * documentation improvements * virtual destructor of BVH manager * remove extra speed benchmark * bugfix for not initialized managers * Licenses revised of old tesseract files * PR review: * replaced include guards through pragma * used default instead of empty {} for ctor/dtor * Comments in Bullet readme about thread safety and speed * Readme for speed benchmark (#1648) * FCL Bullet benchmark readme * Benchmark script and launch file updated * PR review fixups * Adapt cmake for Bullet (#1744) * cmake for using Bullet only if correct version available * Fixup * PR review fixup * Rewrite with own FindBullet.cmake * Use pkg-config * Fix travis failure for melodic * Fix moveit_ros_planning dependency on Bullet * Rename PR2-related collision test files (#1856)
Description
This PR is a follow up to #1499 and #1500 which all deal with adding Bullet as collision checker (see #1427) and fills the empty template using the modified tesseract/trajopt code. I used the given
CollisionWorld
andCollisionRobot
structure.This is an intermediate state where the continuous collision detection has not been added yet. See PR #1551 for the full bullet integration.
Building requires
libbullet-dev
andlibbullet-extras-dev
which can both be installed through apt.Bullet passes all tests which were originally designed for FCL and I proposed in a separate PR #1543 a typed test suite so we can share the test scenarios across all collision checkers. As soon as this is merged, tests in this PR will be replaced with an instantiation of the typed test suite.
See this high level flowchart for the collision checking process using Bullet:
To further understand the collision checking process using Bullet see this detailed flowchart:
Thanks for reviewing!