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 collision_detection_fcl to ROS 2 #41

Merged
merged 20 commits into from
Jun 12, 2019

Conversation

vmayoral
Copy link
Contributor

@vmayoral vmayoral commented Mar 10, 2019

Pending:

  • Port unit tests

@@ -0,0 +1,19 @@
/*
Copy link
Contributor

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?

Copy link
Contributor

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.

Copy link
Contributor

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)

Copy link
Contributor Author

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.

@vmayoral vmayoral mentioned this pull request Mar 20, 2019
Copy link
Member

@henningkayser henningkayser left a 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.

@@ -50,6 +50,8 @@
#include <boost/thread/mutex.hpp>
#include <memory>

rclcpp::Logger logger = rclcpp::get_logger("collision_detection.fcl");
Copy link
Member

@henningkayser henningkayser Apr 9, 2019

Choose a reason for hiding this comment

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

Suggested change
rclcpp::Logger logger = rclcpp::get_logger("collision_detection.fcl");
rclcpp::Logger LOGGER = rclcpp::get_logger("collision_detection.fcl");

Copy link
Contributor

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. "
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
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. "

Copy link
Contributor

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

@@ -52,6 +52,8 @@

#include <boost/bind.hpp>

rclcpp::Logger logger = rclcpp::get_logger("collision_detection.fcl");
Copy link
Member

@henningkayser henningkayser Apr 9, 2019

Choose a reason for hiding this comment

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

Suggested change
rclcpp::Logger logger = rclcpp::get_logger("collision_detection.fcl");
rclcpp::Logger LOGGER = rclcpp::get_logger("collision_detection.fcl");

Copy link
Contributor

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

…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");
Copy link
Contributor

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

Copy link
Contributor

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
Copy link
Contributor

Choose a reason for hiding this comment

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

revert

Copy link
Contributor

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");
Copy link
Contributor

Choose a reason for hiding this comment

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

move inside the namespace

Copy link
Contributor

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");
Copy link
Contributor

Choose a reason for hiding this comment

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

move inside the namespace

Copy link
Contributor

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");
Copy link
Contributor

Choose a reason for hiding this comment

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

move inside the namespace

Copy link
Contributor

Choose a reason for hiding this comment

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

@ahcorde
Copy link
Contributor

ahcorde commented May 24, 2019

@mlautman Updated

@ahcorde ahcorde mentioned this pull request May 24, 2019
14 tasks
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")
Copy link
Contributor

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

Copy link
Contributor

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.

Copy link
Contributor

Choose a reason for hiding this comment

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

friendly ping @mlautman

Copy link
Contributor

@mlautman mlautman left a 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.

@anasarrak
Copy link
Contributor

The remaining issues are already addresed, can we merge this? @mlautman @davetcoleman

@mlautman
Copy link
Contributor

mlautman commented Jun 3, 2019

@anasarrak This is still failing CI. Please investigate why that is and get things passing. Then I will merge

@anasarrak
Copy link
Contributor

@mlautman As @LanderU mentioned on the following issue #92, the CI is not passing because of the latest update on the keys.

@anasarrak
Copy link
Contributor

@mlautman mlautman merged commit f4601e5 into moveit:master Jun 12, 2019
@ahcorde ahcorde deleted the collision-detection-fcl branch June 12, 2019 21:54
MikeWrock pushed a commit to MikeWrock/moveit2 that referenced this pull request Aug 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants