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

Adapt cmake for Bullet #1744

Merged
merged 7 commits into from Jan 17, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions .travis.yml
Expand Up @@ -25,6 +25,7 @@ env:
- TEST="clang-format catkin_lint"
- TEST=code-coverage
- ROS_DISTRO=melodic
- ROS_DISTRO=kinetic
j-petit marked this conversation as resolved.
Show resolved Hide resolved

matrix: # Add a separate config to the matrix, using clang as compiler
include:
Expand Down
29 changes: 23 additions & 6 deletions moveit_core/CMakeLists.txt
Expand Up @@ -21,15 +21,29 @@ endif()

find_package(Boost REQUIRED system filesystem date_time thread iostreams)
find_package(Eigen3 REQUIRED)
# TODO: Move collision detection into separate packages
find_package(Bullet REQUIRED)

list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules")

# TODO: Move collision detection into separate packages
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What will this entail?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was added as suggested here by @rhaschke.

Later, we should factor out FCL and Bullet collision checking into their own packages. Maybe add a todo as a reminder here.

So I guess create stand-alone packages?

find_package(Bullet 2.87)

# TODO(j-petit): Version check can be dropped when Xenial reaches end-of-life
if(BULLET_FOUND)
set(BULLET_ENABLE "BULLET")
set(BULLET_LIB "moveit_collision_detection_bullet")
set(BULLET_INC "collision_detection_bullet/include")
message(STATUS "Compiling with Bullet")
else()
message(STATUS "Version of Bullet too old or not available: disabling Bullet collision detection plugin. Try using Ubuntu 18.04 or later.")
endif()
j-petit marked this conversation as resolved.
Show resolved Hide resolved

find_package(PkgConfig REQUIRED)
pkg_check_modules(LIBFCL_PC REQUIRED fcl)
# find *absolute* paths to LIBFCL_INCLUDE_DIRS and LIBFCL_LIBRARIES
find_path(LIBFCL_INCLUDE_DIRS fcl/config.h HINTS ${LIBFCL_PC_INCLUDE_DIR} ${LIBFCL_PC_INCLUDE_DIRS})
find_library(LIBFCL_LIBRARIES fcl HINTS ${LIBFCL_PC_LIBRARY_DIRS})


find_package(octomap REQUIRED)
find_package(urdfdom REQUIRED)
find_package(urdfdom_headers REQUIRED)
Expand Down Expand Up @@ -71,7 +85,7 @@ set(THIS_PACKAGE_INCLUDE_DIRS
backtrace/include
collision_detection/include
collision_detection_fcl/include
collision_detection_bullet/include
${BULLET_INC}
constraint_samplers/include
controller_manager/include
distance_field/include
Expand Down Expand Up @@ -108,7 +122,7 @@ catkin_package(
moveit_planning_interface
moveit_collision_detection
moveit_collision_detection_fcl
moveit_collision_detection_bullet
${BULLET_LIB}
moveit_kinematic_constraints
moveit_planning_scene
moveit_constraint_samplers
Expand Down Expand Up @@ -145,7 +159,7 @@ catkin_package(
OCTOMAP
urdfdom
urdfdom_headers
BULLET
${BULLET_ENABLE}
)

include_directories(SYSTEM ${EIGEN3_INCLUDE_DIRS}
Expand Down Expand Up @@ -190,7 +204,6 @@ add_subdirectory(robot_state)
add_subdirectory(robot_trajectory)
add_subdirectory(collision_detection)
add_subdirectory(collision_detection_fcl)
add_subdirectory(collision_detection_bullet)
add_subdirectory(kinematic_constraints)
add_subdirectory(planning_scene)
add_subdirectory(constraint_samplers)
Expand All @@ -201,3 +214,7 @@ add_subdirectory(distance_field)
add_subdirectory(collision_distance_field)
add_subdirectory(kinematics_metrics)
add_subdirectory(dynamics_solver)

if(BULLET_ENABLE)
add_subdirectory(collision_detection_bullet)
endif()
10 changes: 10 additions & 0 deletions moveit_core/CMakeModules/FindBullet.cmake
@@ -0,0 +1,10 @@
include(FindPackageHandleStandardArgs)
find_package(PkgConfig)

if(PKGCONFIG_FOUND)
pkg_check_modules(BULLET bullet)
Copy link
Contributor

@mamoll mamoll Jan 17, 2020

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})

Copy link
Contributor Author

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.

Copy link
Contributor

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.

endif()

find_package_handle_standard_args(Bullet
REQUIRED_VARS BULLET_LIBRARIES BULLET_INCLUDE_DIRS
VERSION_VAR BULLET_VERSION)
6 changes: 4 additions & 2 deletions moveit_ros/planning/planning_components_tools/CMakeLists.txt
Expand Up @@ -14,8 +14,10 @@ target_link_libraries(moveit_visualize_robot_collision_volume moveit_planning_sc
add_executable(moveit_evaluate_collision_checking_speed src/evaluate_collision_checking_speed.cpp)
target_link_libraries(moveit_evaluate_collision_checking_speed moveit_planning_scene_monitor ${catkin_LIBRARIES} ${Boost_LIBRARIES})

add_executable(moveit_compare_collision_checking_speed_fcl_bullet src/compare_collision_speed_checking_fcl_bullet.cpp)
target_link_libraries(moveit_compare_collision_checking_speed_fcl_bullet moveit_planning_scene_monitor ${catkin_LIBRARIES} ${Boost_LIBRARIES})
if("${catkin_LIBRARIES}" MATCHES "moveit_collision_detection_bullet")
add_executable(moveit_compare_collision_checking_speed_fcl_bullet src/compare_collision_speed_checking_fcl_bullet.cpp)
target_link_libraries(moveit_compare_collision_checking_speed_fcl_bullet moveit_planning_scene_monitor ${catkin_LIBRARIES} ${Boost_LIBRARIES})
endif()

add_executable(moveit_kinematics_speed_and_validity_evaluator src/kinematics_speed_and_validity_evaluator.cpp)
target_link_libraries(moveit_kinematics_speed_and_validity_evaluator moveit_robot_model_loader ${catkin_LIBRARIES} ${Boost_LIBRARIES})
Expand Down