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

port of bullet collision to ros2 #322

Merged
merged 10 commits into from
Mar 10, 2021
33 changes: 10 additions & 23 deletions moveit_core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,8 @@ include(ConfigExtras.cmake)

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

# TODO(henningkayser): enable bullet once the library is migrated to ROS2
# TODO: Move collision detection into separate 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()
find_package(Bullet 2.87 REQUIRED)

find_package(PkgConfig REQUIRED)

Expand Down Expand Up @@ -70,7 +59,7 @@ set(THIS_PACKAGE_INCLUDE_DIRS
backtrace/include
collision_detection/include
collision_detection_fcl/include
# ${BULLET_INC}
${BULLET_INC}
constraint_samplers/include
controller_manager/include
distance_field/include
Expand Down Expand Up @@ -104,9 +93,7 @@ set(THIS_PACKAGE_LIBRARIES
moveit_planning_interface
moveit_collision_detection
moveit_collision_detection_fcl
collision_detector_fcl_plugin
# ${BULLET_LIB}
# collision_detector_bullet_plugin
${BULLET_LIB}
moveit_kinematic_constraints
moveit_planning_scene
moveit_constraint_samplers
Expand Down Expand Up @@ -140,13 +127,13 @@ set(THIS_PACKAGE_INCLUDE_DEPENDS
Eigen3
eigen3_cmake_module
OCTOMAP
# ${BULLET_ENABLE}
${BULLET_ENABLE}
)
pluginlib_export_plugin_description_file(moveit_core collision_detector_fcl_description.xml)

include_directories(SYSTEM ${EIGEN3_INCLUDE_DIRS}
${LIBFCL_INCLUDE_DIRS}
# ${BULLET_INCLUDE_DIRS}
${BULLET_INCLUDE_DIRS}
)

include_directories(${THIS_PACKAGE_INCLUDE_DIRS}
Expand Down Expand Up @@ -189,11 +176,11 @@ add_subdirectory(collision_distance_field)
add_subdirectory(kinematics_metrics)
add_subdirectory(dynamics_solver)
# TODO(henningkayser): enable bullet once the library is migrated to ROS2
# if(BULLET_ENABLE)
# add_subdirectory(collision_detection_bullet)
# else()
# install(FILES collision_detection_bullet/empty_description.xml DESTINATION share/${PROJECT_NAME} RENAME collision_detector_bullet_description.xml)
# endif()
if(BULLET_ENABLE)
add_subdirectory(collision_detection_bullet)
else()
install(FILES collision_detection_bullet/empty_description.xml DESTINATION share/${PROJECT_NAME} RENAME collision_detector_bullet_description.xml)
endif()

install(
TARGETS ${THIS_PACKAGE_LIBRARIES}
Expand Down
62 changes: 48 additions & 14 deletions moveit_core/collision_detection_bullet/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,34 +6,68 @@ add_library(${MOVEIT_LIB_NAME}
src/bullet_integration/bullet_cast_bvh_manager.cpp
src/collision_env_bullet.cpp
src/bullet_integration/bullet_bvh_manager.cpp
src/bullet_integration/contact_checker_common.cpp
src/bullet_integration/ros_bullet_utils.cpp
)
set_target_properties(${MOVEIT_LIB_NAME} PROPERTIES VERSION "${${PROJECT_NAME}_VERSION}")

target_link_libraries(${MOVEIT_LIB_NAME} moveit_collision_detection
${catkin_LIBRARIES} ${urdfdom_LIBRARIES}
${urdfdom_headers_LIBRARIES} ${Boost_LIBRARIES}
${BULLET_LIBRARIES})
add_dependencies(${MOVEIT_LIB_NAME} ${catkin_EXPORTED_TARGETS})
ament_target_dependencies(${MOVEIT_LIB_NAME}
rclcpp
rmw_implementation
urdf
urdfdom
urdfdom_headers
Boost
visualization_msgs
)
target_link_libraries(${MOVEIT_LIB_NAME}
moveit_collision_detection
${BULLET_LIBRARIES}
)

add_library(collision_detector_bullet_plugin src/collision_detector_bullet_plugin_loader.cpp)
set_target_properties(collision_detector_bullet_plugin PROPERTIES VERSION "${${PROJECT_NAME}_VERSION}")
target_link_libraries(collision_detector_bullet_plugin ${catkin_LIBRARIES} ${MOVEIT_LIB_NAME})
ament_target_dependencies(collision_detector_bullet_plugin
rclcpp
urdf
visualization_msgs
pluginlib
rmw_implementation
)
target_link_libraries(collision_detector_bullet_plugin
${MOVEIT_LIB_NAME}
moveit_planning_scene
)

install(TARGETS ${MOVEIT_LIB_NAME} EXPORT ${MOVEIT_LIB_NAME}
TARGETS collision_detector_bullet_plugin EXPORT collision_detector_bullet_plugin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
RUNTIME DESTINATION bin
)
install(DIRECTORY include/ DESTINATION include)

install(FILES ../collision_detector_bullet_description.xml DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION})
install(DIRECTORY include/ DESTINATION ${CATKIN_GLOBAL_INCLUDE_DESTINATION})

if(BUILD_TESTING)
if(WIN32)
# set(append_library_dirs "$<TARGET_FILE_DIR:${PROJECT_NAME}>;$<TARGET_FILE_DIR:${PROJECT_NAME}_TestPlugins1>")
else()
set(append_library_dirs "${CMAKE_CURRENT_BINARY_DIR};${CMAKE_CURRENT_BINARY_DIR}/../collision_detection;${CMAKE_CURRENT_BINARY_DIR}/../robot_state;${CMAKE_CURRENT_BINARY_DIR}/../robot_model;${CMAKE_CURRENT_BINARY_DIR}/../utils")
endif()

if(CATKIN_ENABLE_TESTING)
catkin_add_gtest(test_bullet_collision_detection test/test_bullet_collision_detection_pr2.cpp)
target_link_libraries(test_bullet_collision_detection moveit_test_utils ${MOVEIT_LIB_NAME} ${Boost_LIBRARIES})
ament_add_gtest(test_bullet_collision_detection test/test_bullet_collision_detection_pr2.cpp)
target_link_libraries(test_bullet_collision_detection moveit_test_utils ${MOVEIT_LIB_NAME})
# TODO: remove if transition to gtest's new API TYPED_TEST_SUITE_P is finished
target_compile_options(test_bullet_collision_detection PRIVATE -Wno-deprecated-declarations)

catkin_add_gtest(test_bullet_collision_detection_panda test/test_bullet_collision_detection_panda.cpp)
target_link_libraries(test_bullet_collision_detection_panda moveit_test_utils ${MOVEIT_LIB_NAME} ${Boost_LIBRARIES})
ament_add_gtest(test_bullet_collision_detection_panda test/test_bullet_collision_detection_panda.cpp)
target_link_libraries(test_bullet_collision_detection_panda moveit_test_utils ${MOVEIT_LIB_NAME})
# TODO: remove if transition to gtest's new API TYPED_TEST_SUITE_P is finished
target_compile_options(test_bullet_collision_detection_panda PRIVATE -Wno-deprecated-declarations)

catkin_add_gtest(test_bullet_continuous_collision_checking test/test_bullet_continuous_collision_checking.cpp)
target_link_libraries(test_bullet_continuous_collision_checking moveit_test_utils ${MOVEIT_LIB_NAME} ${Boost_LIBRARIES})
ament_add_gtest(test_bullet_continuous_collision_checking test/test_bullet_continuous_collision_checking.cpp)
target_link_libraries(test_bullet_continuous_collision_checking moveit_test_utils ${MOVEIT_LIB_NAME})
# TODO: remove if transition to gtest's new API TYPED_TEST_SUITE_P is finished
target_compile_options(test_bullet_continuous_collision_checking PRIVATE -Wno-deprecated-declarations)
endif()
Loading