Skip to content
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

Merged
merged 24 commits into from Jul 23, 2019

Conversation

j-petit
Copy link
Contributor

@j-petit j-petit commented Jun 14, 2019

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 and CollisionRobot 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 and libbullet-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:
Bullet_collision_moveit

To further understand the collision checking process using Bullet see this detailed flowchart:
BulletChecking_detailed

Thanks for reviewing!

Copy link
Contributor

@BryceStevenWilley BryceStevenWilley left a 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.

@j-petit j-petit changed the base branch from master to feature-bullet-collision June 26, 2019 07:24
Copy link
Contributor

@BryceStevenWilley BryceStevenWilley left a 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)

@j-petit j-petit force-pushed the integrating_bullet branch 2 times, most recently from 43b0d5c to 3ab813e Compare July 4, 2019 09:09
@BryceStevenWilley
Copy link
Contributor

This is close to being ready, the last big thing that I'd suggest is to git rebase -i and cleanup the commits so they're easier to read through, i.e. making format commits fixups of previous commits, combining related commits, etc.

Copy link
Contributor

@BryceStevenWilley BryceStevenWilley left a 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

@j-petit j-petit force-pushed the integrating_bullet branch 2 times, most recently from 2d46eb5 to fd1c53f Compare July 8, 2019 15:29
@j-petit j-petit force-pushed the integrating_bullet branch 2 times, most recently from 607fc77 to 8cca933 Compare July 8, 2019 15:57
@j-petit j-petit closed this Jul 8, 2019
@j-petit j-petit reopened this Jul 8, 2019
@j-petit j-petit force-pushed the integrating_bullet branch 2 times, most recently from 9c4f2a5 to 01fdb79 Compare July 9, 2019 16:00
@BryceStevenWilley BryceStevenWilley changed the title Adding Bullet and Tesseract into MoveIt [WIP] Adding Bullet and Tesseract into MoveIt Jul 9, 2019
Copy link
Contributor

@rhaschke rhaschke left a 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/CMakeLists.txt Outdated Show resolved Hide resolved
moveit_core/CMakeLists.txt Show resolved Hide resolved
moveit_core/collision_detection_bullet/CMakeLists.txt Outdated Show resolved Hide resolved
moveit_core/collision_detection_bullet/CMakeLists.txt Outdated Show resolved Hide resolved
{
}

const std::vector<std::string>& active;
Copy link
Contributor

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;
Copy link
Contributor

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...

Copy link
Contributor Author

@j-petit j-petit Jul 15, 2019

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.

Copy link
Contributor

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?

Copy link
Contributor Author

@j-petit j-petit Jul 15, 2019

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.

Copy link
Contributor

@rhaschke rhaschke left a 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.

@davetcoleman
Copy link
Member

Excited to seeing this close to ready! Travis is still unhappy...

@j-petit
Copy link
Contributor Author

j-petit commented Jul 17, 2019

Excited to seeing this close to ready! Travis is still unhappy...

Only kinetic is now failing (it does not need to pass, right?), the three other builds pass 🎉

@rhaschke
Copy link
Contributor

Only kinetic is now failing.

Looks like Kinetic/Xenial ships with an older Bullet version. I suggest dropping Kinetic support for now.

@davetcoleman
Copy link
Member

Moving this convo here: #1570
;-)

@j-petit
Copy link
Contributor Author

j-petit commented Jul 23, 2019

Ping
Can we get this merged / further discussed / reviewed ?

@rhaschke rhaschke merged commit c143e20 into moveit:feature-bullet-collision Jul 23, 2019
@j-petit
Copy link
Contributor Author

j-petit commented Jul 24, 2019

Thanks for reviewing, next up is #1551 for the continuous collision checking.

BryceStevenWilley pushed a commit to BryceStevenWilley/moveit that referenced this pull request Jul 24, 2019
* 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
@j-petit j-petit deleted the integrating_bullet branch August 22, 2019 08:21
j-petit added a commit to j-petit/moveit that referenced this pull request Aug 23, 2019
* 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
j-petit added a commit to j-petit/moveit that referenced this pull request Nov 20, 2019
* 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
j-petit added a commit to j-petit/moveit that referenced this pull request Jan 12, 2020
* 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
davetcoleman pushed a commit that referenced this pull request Jan 23, 2020
* 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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants