Skip to content

Port collision_detection_fcl to ROS 2 - #41

Merged
mlautman merged 20 commits into
moveit:masterfrom
AcutronicRobotics:collision-detection-fcl
Jun 12, 2019
Merged

mlautman merged 20 commits into
moveit:masterfrom
AcutronicRobotics:collision-detection-fcl

Conversation

@vmayoral

@vmayoral vmayoral commented Mar 10, 2019 •

Copy link
Copy Markdown
Contributor

Pending:

  • Port unit tests

@@ -0,0 +1,19 @@
/*

Copy link
Copy Markdown
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/moveit1@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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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

@henningkayser henningkayser left a comment

Copy link
Copy Markdown
Member

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.

#include <boost/thread/mutex.hpp>
#include <memory>

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

@henningkayser henningkayser Apr 9, 2019 •

Copy link
Copy Markdown
Member

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
Copy Markdown
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)

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
Copy Markdown
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
Copy Markdown
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


#include <boost/bind.hpp>

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

@henningkayser henningkayser Apr 9, 2019 •

Copy link
Copy Markdown
Member

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
Copy Markdown
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 <[email protected]>
namespace collision_detection
{
const std::string CollisionDetectorAllocatorFCL::NAME("FCL");
const std::string CollisionDetectorAllocatorFCL::NAME_("FCL");

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

Choose a reason for hiding this comment

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

{
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
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

revert

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

#include <boost/thread/mutex.hpp>
#include <memory>

rclcpp::Logger LOGGER_COLLISION_DETECTION = rclcpp::get_logger("collision_detection.fcl");

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

Choose a reason for hiding this comment

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

#include <fcl/broadphase/broadphase_dynamic_AABB_tree.h>
#endif

rclcpp::Logger LOGGER_COLLISION_ROBOT_FCL = rclcpp::get_logger("collision_robot.fcl");

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

Choose a reason for hiding this comment

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


#include <boost/bind.hpp>

rclcpp::Logger LOGGER_COLLISION_WORLD = rclcpp::get_logger("collision_world.fcl");

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

Choose a reason for hiding this comment

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

@ahcorde

ahcorde commented May 24, 2019

Copy link
Copy Markdown
Contributor

@mlautman Updated

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

Choose a reason for hiding this comment

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

friendly ping @mlautman

@mlautman mlautman left a comment

Copy link
Copy Markdown
Contributor

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

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

@mlautman

mlautman commented Jun 3, 2019

Copy link
Copy Markdown
Contributor

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

@anasarrak

Copy link
Copy Markdown
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
Copy Markdown
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.

7 participants