-
Notifications
You must be signed in to change notification settings - Fork 564
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 collision_detection_fcl to ROS 2 #41
Port collision_detection_fcl to ROS 2 #41
Conversation
Authored by @anasarrak
@@ -0,0 +1,19 @@ | |||
/* |
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.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
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'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
@@ -50,6 +50,8 @@ | |||
#include <boost/thread/mutex.hpp> | |||
#include <memory> | |||
|
|||
rclcpp::Logger logger = rclcpp::get_logger("collision_detection.fcl"); |
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.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The issue has been addressed on the following #41 (comment)
@@ -96,16 +98,15 @@ bool collisionCallback(fcl::CollisionObjectd* o1, fcl::CollisionObjectd* o2, voi | |||
{ | |||
always_allow_collision = true; | |||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
@@ -52,6 +52,8 @@ | |||
|
|||
#include <boost/bind.hpp> | |||
|
|||
rclcpp::Logger logger = rclcpp::get_logger("collision_detection.fcl"); |
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.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 <[email protected]>
namespace collision_detection | ||
{ | ||
const std::string CollisionDetectorAllocatorFCL::NAME("FCL"); | ||
const std::string CollisionDetectorAllocatorFCL::NAME_("FCL"); |
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.
This has to match CollisionDetectorAllocatorTemplate::NAME
please revert
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.
@@ -48,7 +48,7 @@ class CollisionDetectorAllocatorFCL | |||
: public CollisionDetectorAllocatorTemplate<CollisionWorldFCL, CollisionRobotFCL, CollisionDetectorAllocatorFCL> | |||
{ | |||
public: | |||
static const std::string NAME; // defined in collision_world_fcl.cpp | |||
static const std::string NAME_; // defined in collision_world_fcl.cpp |
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.
revert
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.
@@ -50,6 +50,8 @@ | |||
#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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
move inside the namespace
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.
@@ -41,6 +41,8 @@ | |||
#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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
move inside the namespace
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.
@@ -52,9 +52,11 @@ | |||
|
|||
#include <boost/bind.hpp> | |||
|
|||
rclcpp::Logger LOGGER_COLLISION_WORLD = rclcpp::get_logger("collision_world.fcl"); |
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.
move inside the namespace
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.
@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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
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.
friendly ping @mlautman
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.
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: