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
Adapt cmake for Bullet #1744
Adapt cmake for Bullet #1744
Conversation
moveit_core/CMakeLists.txt
Outdated
set(BULLET_INCLUDE_DIRS "${BULLET_ROOT_DIR}/${BULLET_INCLUDE_DIRS}") | ||
set(BULLET_INCLUDE_DIR "${BULLET_ROOT_DIR}/${BULLET_INCLUDE_DIR}") | ||
set(BULLET_LIBRARY_DIRS "${BULLET_ROOT_DIR}/${BULLET_LIBRARY_DIRS}") | ||
set(BULLET_LIBRARIES "libBulletDynamics.so;libBulletCollision.so;libLinearMath.so;libBulletSoftBody.so") |
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.
Can you explain why you added this?
Especially the BULLET_LIBRARIES
values seem strange, as CMake typically uses absolute paths to libraries, and BULLET_LIBRARIES
should already contain the proper values.
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.
Somehow, the BulletConfig.cmake
file coming with libbullet-dev
does not fit the library files coming with it. I was also wondering why this is the case. See the content of the config:
# -*- cmake -*-
#
# BulletConfig.cmake(.in)
#
# Use the following variables to compile and link against Bullet:
# BULLET_FOUND - True if Bullet was found on your system
# BULLET_USE_FILE - The file making Bullet usable
# BULLET_DEFINITIONS - Definitions needed to build with Bullet
# BULLET_INCLUDE_DIR - Directory where Bullet-C-Api.h can be found
# BULLET_INCLUDE_DIRS - List of directories of Bullet and it's dependencies
# BULLET_LIBRARIES - List of libraries to link against Bullet library
# BULLET_LIBRARY_DIRS - List of directories containing Bullet' libraries
# BULLET_ROOT_DIR - The base directory of Bullet
# BULLET_VERSION_STRING - A human-readable string containing the version
set ( BULLET_FOUND 1 )
set ( BULLET_USE_FILE "lib/x86_64-linux-gnu/cmake/bullet/UseBullet.cmake" )
set ( BULLET_DEFINITIONS "" )
set ( BULLET_INCLUDE_DIR "include/bullet" )
set ( BULLET_INCLUDE_DIRS "include/bullet" )
set ( BULLET_LIBRARIES "LinearMath;Bullet3Common;BulletInverseDynamics;BulletCollision;BulletDynamics;BulletSoftBody" )
set ( BULLET_LIBRARY_DIRS "lib/x86_64-linux-gnu" )
set ( BULLET_ROOT_DIR "/usr" )
set ( BULLET_VERSION_STRING "2.87" )
And see the files coming with it at https://packages.ubuntu.com/bionic/i386/libbullet-dev/filelist. There is no BulletInverseDynamics
coming with this package. I am also not very happy about the fact that I have to define them manually and do this concatenation with the root directory.. any ideas?
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.
When I simply use find_package(Bullet)
this works fine, as it uses the FindBullet.cmake
. However, this does not include the version number.
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 don't like this approach as well. What about providing our own FindBullet.cmake?
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.
Isn't this file provided by the cmake installation?
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.
Any proposals where in the source tree such a file should go?
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 moveit_core/CMakeModules
? In moveit_core/CMakeLists.txt
you'd add something like this:
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules")
find_package(Bullet)
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 am struggling to get this running. My idea is to have the custom FindBullet.cmake
be more or less a replicate of the official one plus checking somehow the BulletConfig.cmake
which comes with libbullet-dev
for the BULLET_VERSION_STRING
.
However if I do include(.../BulletConfig.cmake)
in the FindBullet.cmake
I get all the variables set which clutters the FindBullet.cmake
to the point that I cannot build succesfully anymore. I would like to only partially include the BulletConfig.cmake
but I cannot find that option in cmake.
Any ideas?
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.
You can also use the cmake PkgConfig module (since bullet also has a bullet.pc file). Your FindBullet.cmake might then look something like this:
include(FindPackageHandleStandardArgs)
find_package(PkgConfig)
if(PKGCONFIG_FOUND)
pkg_check_modules(bullet>=2.88)
endif()
find_package_handle_standard_args(Bullet DEFAULT_MSG BULLET_LIBRARIES BULLET_INCLUDE_DIRS)
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.
That worked :), thank you @mamoll for the help!
# TODO: Move collision detection into separate packages | ||
find_package(Bullet REQUIRED) | ||
|
||
# TODO: Move collision detection into separate packages |
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.
What will this entail?
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.
564829e
to
c27556a
Compare
@j-petit, this needs to be rebased onto the (rebased) feature branch now... |
a7db055
to
1fd192d
Compare
241a293
to
44ad915
Compare
Travis fails because the feature branch is behind master (issues with |
4f77ab3
to
753604c
Compare
44ad915
to
6bab622
Compare
So it passes, can someone give this a final review? |
Codecov Report
@@ Coverage Diff @@
## feature-bullet-trajopt #1744 +/- ##
=========================================================
Coverage ? 50.29%
=========================================================
Files ? 312
Lines ? 24536
Branches ? 0
=========================================================
Hits ? 12341
Misses ? 12195
Partials ? 0 Continue to review full report at Codecov.
|
Ping @mamoll |
find_package(PkgConfig) | ||
|
||
if(PKGCONFIG_FOUND) | ||
pkg_check_modules(BULLET bullet) |
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 that be
pkg_check_modules(BULLET Bullet>=${Bullet_FIND_VERSION})
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.
the version is handled in the last line through VERSION_VAR BULLET_VERSION
which makes it possible to use find_package(Bullet 2.87)
in the moveit_core/CMakeLists.txt
. I found that clearer to have the requirement for the Bullet version in the moveit_core/CmakeLists.txt
instead of hidden inside the FindBullet.cmake
.
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 missed that. That's even better.
* 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 adapts the build process in order to add the Bullet dependent code only if the available version is greater than Bullet version 2.86 (2.87 is the one available through apt on Ubuntu 18.04).