Port collision_detection_fcl to ROS 2#41
Conversation
Authored by @anasarrak
| @@ -0,0 +1,19 @@ | |||
| /* | |||
There was a problem hiding this comment.
This file should be available by cherry picking in moveit/moveit@d8a9337. I don't think it is a good idea to copy-paste in this file without the rest of the PR?
@BryceStevenWilley can you comment on this?
There was a problem hiding this comment.
Agreed, cherry picking that PR should be easier. This PR is missing the plugin XML, and the modification to the package.xml. FCL will still load by default, but things might break when you try to manually load the plugin. However, I can't speak to how pluginlib works in ROS2/if any of these files need to be modified.
There was a problem hiding this comment.
@vmayoral As your team tackles pluginlib in ros2, it may be helpful to have examples to draw from. RQT2 and RVIZ2 both use pluginlib.
When I was porting the CPP plugin provider for RQT2 this README in the rviz2 repo was really useful: https://github.com/ros2/rviz/blob/ros2/docs/plugin_development.md#plugin-basics
rqt_gui_cpp in the rqt repo uses the new pluginlib for ros2. It may be helpful to look at the diff between crystal-devel and kinetic-devel and reference the changes to rqt_gui_cpp.
rqt_image_view is another good example of a plugin that gets registered and loaded by pluginlib:
branch
(Diff between master and crystal-devel)
There was a problem hiding this comment.
Thanks @mlautman having look now. Experiencing some issues with rviz2 though ros2/rviz#385 in OS X.
moveit_core/collision_detection_fcl/include/moveit/collision_detection_fcl/collision_common.h
Outdated
Show resolved
Hide resolved
...it_core/collision_detection_fcl/include/moveit/collision_detection_fcl/collision_robot_fcl.h
Outdated
Show resolved
Hide resolved
...it_core/collision_detection_fcl/include/moveit/collision_detection_fcl/collision_world_fcl.h
Outdated
Show resolved
Hide resolved
henningkayser
left a comment
There was a problem hiding this comment.
I'll approve with this minor refactoring to use const rclcpp::Logger LOGGER.
moveit_core/collision_detection_fcl/include/moveit/collision_detection_fcl/collision_common.h
Outdated
Show resolved
Hide resolved
| #include <boost/thread/mutex.hpp> | ||
| #include <memory> | ||
|
|
||
| rclcpp::Logger logger = rclcpp::get_logger("collision_detection.fcl"); |
There was a problem hiding this comment.
| rclcpp::Logger logger = rclcpp::get_logger("collision_detection.fcl"); | |
| rclcpp::Logger LOGGER = rclcpp::get_logger("collision_detection.fcl"); |
There was a problem hiding this comment.
The issue has been addressed on the following #41 (comment)
| if (cdata->req_->verbose) | ||
| ROS_DEBUG_NAMED( | ||
| "collision_detection.fcl", "Collision between '%s' (type '%s') and '%s' (type '%s') is always allowed. " | ||
| RCLCPP_DEBUG(logger, "Collision between '%s' (type '%s') and '%s' (type '%s') is always allowed. " |
There was a problem hiding this comment.
| RCLCPP_DEBUG(logger, "Collision between '%s' (type '%s') and '%s' (type '%s') is always allowed. " | |
| RCLCPP_DEBUG(LOGGER, "Collision between '%s' (type '%s') and '%s' (type '%s') is always allowed. " |
There was a problem hiding this comment.
We have changed the logger name, this should be fixed a3011f8
moveit_core/collision_detection_fcl/src/collision_robot_fcl.cpp
Outdated
Show resolved
Hide resolved
moveit_core/collision_detection_fcl/src/collision_robot_fcl.cpp
Outdated
Show resolved
Hide resolved
|
|
||
| #include <boost/bind.hpp> | ||
|
|
||
| rclcpp::Logger logger = rclcpp::get_logger("collision_detection.fcl"); |
There was a problem hiding this comment.
| rclcpp::Logger logger = rclcpp::get_logger("collision_detection.fcl"); | |
| rclcpp::Logger LOGGER = rclcpp::get_logger("collision_detection.fcl"); |
There was a problem hiding this comment.
We have changed the logger name, this should be fixed a3011f8
moveit_core/collision_detection_fcl/src/collision_world_fcl.cpp
Outdated
Show resolved
Hide resolved
moveit_core/collision_detection_fcl/src/collision_world_fcl.cpp
Outdated
Show resolved
Hide resolved
…etection_fcl/collision_common.h Thanks Co-Authored-By: Henning Kayser <henningkayser@picknik.ai>
| namespace collision_detection | ||
| { | ||
| const std::string CollisionDetectorAllocatorFCL::NAME("FCL"); | ||
| const std::string CollisionDetectorAllocatorFCL::NAME_("FCL"); |
There was a problem hiding this comment.
This has to match CollisionDetectorAllocatorTemplate::NAME please revert
| { | ||
| public: | ||
| static const std::string NAME; // defined in collision_world_fcl.cpp | ||
| static const std::string NAME_; // defined in collision_world_fcl.cpp |
| #include <boost/thread/mutex.hpp> | ||
| #include <memory> | ||
|
|
||
| rclcpp::Logger LOGGER_COLLISION_DETECTION = rclcpp::get_logger("collision_detection.fcl"); |
There was a problem hiding this comment.
move inside the namespace
| #include <fcl/broadphase/broadphase_dynamic_AABB_tree.h> | ||
| #endif | ||
|
|
||
| rclcpp::Logger LOGGER_COLLISION_ROBOT_FCL = rclcpp::get_logger("collision_robot.fcl"); |
There was a problem hiding this comment.
move inside the namespace
|
|
||
| #include <boost/bind.hpp> | ||
|
|
||
| rclcpp::Logger LOGGER_COLLISION_WORLD = rclcpp::get_logger("collision_world.fcl"); |
There was a problem hiding this comment.
move inside the namespace
|
@mlautman Updated |
| 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") |
There was a problem hiding this comment.
Hardcoding relative paths is a bad idea.
I would recommend that for every library in this package that is used else ware you set a <lib_name>_lib_dir environment variable that can then be used by the tests
A good example is the rcl_lib_dir I have taken the time to show how it is used below:
/home/mike/ws_ros2/src/ros2/rcl/rcl/CMakeLists.txt:
78
79: # rcl_lib_dir is passed as APPEND_LIBRARY_DIRS for each ament_add_gtest call so
80 # the librcl that they link against is on the library path.
81 # This is especially important on Windows.
82 # This is overwritten each loop, but which one it points to doesn't really matter.
83: set(rcl_lib_dir "$<TARGET_FILE_DIR:${PROJECT_NAME}>")
84
/home/mike/ws_ros2/src/ros2/rcl/rcl/test/CMakeLists.txt:
16
17: set(extra_lib_dirs "${rcl_lib_dir}")
18
/home/mike/ws_ros2/src/ros2/rcl/rcl/test/CMakeLists.txt:
34 rcl_add_custom_gtest(test_client${target_suffix}
35 SRCS rcl/test_client.cpp
36: INCLUDE_DIRS ${osrf_testing_tools_cpp_INCLUDE_DIRS}
37 ENV ${rmw_implementation_env_var}
38 APPEND_LIBRARY_DIRS ${extra_lib_dirs}
The example uses rcl_add_custom_gtest but it works just as well with ament_add_gtest
There was a problem hiding this comment.
If you don't mind I prefer to merge this. And then I will fix them all together. Because we have other merged that use this style. I can open an issue to avoid forgetting it.
mlautman
left a comment
There was a problem hiding this comment.
See comment about CMakeLists.txt I approve once the feedback has been addressed.
moveit_core/collision_detection_fcl/test/test_fcl_collision_detection.cpp
Outdated
Show resolved
Hide resolved
|
The remaining issues are already addresed, can we merge this? @mlautman @davetcoleman |
|
@anasarrak This is still failing CI. Please investigate why that is and get things passing. Then I will merge |
Pending: