0
$\begingroup$

Rosanswers logo

I want to work with pcl_ros in a package but I don't know how to include it in the CMakeLists.txt file. I tried to use:

find_package(catkin REQUIRED
    roscpp
    sensor_msgs
    pcl_ros
)

Unfortunately it is not working. I get an error when compiling.

I am using ROS Hydro (catkin system) but the perception package (pcl_ros) was downloaded manually and is inside my workspace.

I would appreciate if you can help me.

[EDIT]

CMake Error at /home/summitxl/catkin_ws/build/Compilados/pcl_msgs-hydro-devel/cmake/pcl_msgs-genmsg.cmake:53 (add_custom_target):
  add_custom_target cannot create target "pcl_msgs_generate_messages_cpp"
  because another target with the same name already exists.  The existing
  target is a custom target created in source directory
  "/home/summitxl/catkin_ws/src/pcl2_to_scan".  See documentation for policy
  CMP0002 for more details.
Call Stack (most recent call first):
  /home/summitxl/ros_catkin_ws/install_isolated/share/genmsg/cmake/genmsg-extras.cmake:299 (include)
  Compilados/pcl_msgs-hydro-devel/CMakeLists.txt:14 (generate_messages)    

CMake Error at /home/summitxl/catkin_ws/build/Compilados/pcl_msgs-hydro-devel/cmake/pcl_msgs-genmsg.cmake:100 (add_custom_target):
  add_custom_target cannot create target "pcl_msgs_generate_messages_lisp"
  because another target with the same name already exists.  The existing
  target is a custom target created in source directory
  "/home/summitxl/catkin_ws/src/pcl2_to_scan".  See documentation for policy
  CMP0002 for more details.
Call Stack (most recent call first):
  /home/summitxl/ros_catkin_ws/install_isolated/share/genmsg/cmake/genmsg-extras.cmake:299 (include)
  Compilados/pcl_msgs-hydro-devel/CMakeLists.txt:14 (generate_messages)


CMake Error at /home/summitxl/catkin_ws/build/Compilados/pcl_msgs-hydro-devel/cmake/pcl_msgs-genmsg.cmake:147 (add_custom_target):
  add_custom_target cannot create target "pcl_msgs_generate_messages_py"
  because another target with the same name already exists.  The existing
  target is a custom target created in source directory
  "/home/summitxl/catkin_ws/src/pcl2_to_scan".  See documentation for policy
  CMP0002 for more details.
Call Stack (most recent call first):
  /home/summitxl/ros_catkin_ws/install_isolated/share/genmsg/cmake/genmsg-extras.cmake:299 (include)
  Compilados/pcl_msgs-hydro-devel/CMakeLists.txt:14 (generate_messages)

CMake Error at /home/summitxl/ros_catkin_ws/install_isolated/share/dynamic_reconfigure/cmake/extras.cmake:60 (add_custom_target):
  add_custom_target cannot create target "pcl_ros_gencfg" because another
  target with the same name already exists.  The existing target is a custom
  target created in source directory
  "/home/summitxl/catkin_ws/src/pcl2_to_scan".  See documentation for policy
  CMP0002 for more details.
Call Stack (most recent call first):
  perception_pcl-hydro-devel/pcl_ros/CMakeLists.txt:43 (generate_dynamic_reconfigure_options)

CMake Warning at navigation-hydro-devel/costmap_2d/CMakeLists.txt:143 (find_package):
  By not providing "Findgtest.cmake" in CMAKE_MODULE_PATH this project has
  asked CMake to find a package configuration file provided by "gtest", but
  CMake did not find one.

  Could not find a package configuration file provided by "gtest" with any of
  the following names:

    gtestConfig.cmake
    gtest-config.cmake

  Add the installation prefix of "gtest" to CMAKE_PREFIX_PATH or set
  "gtest_DIR" to a directory containing one of the above files.  If "gtest"
  provides a separate development package or SDK, be sure it has been
  installed.

Originally posted by arenillas on ROS Answers with karma: 223 on 2014-08-25

Post score: 0


Original comments

Comment by BennyRe on 2014-08-25:
What is the error message?

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

Well, from the error messages it looks like the targets in your custom package pcl2_to_scan are conflicting with pcl_msgs. Which leads me to believe that you have not only pcl_ros, but the whole perception_pcl stack inside your workspace.

If you need to modify and overlay some part of pcl_ros:

  • clean your build folders (rm -rf build devel)
  • install ros-hydro-perception-pcl so that all the dependencies are met
  • clone https://github.com/ros-perception/perception_pcl to your workspace, you can get rid of the perception_pcl metapackage.
  • try to build the workspace with only pcl_ros inside of it, remove all your custom code for now.
  • once that builds successfully, and it should, try roscd pcl_ros to make sure that rospack is using the overlay instead of the system installation
  • track down the naming conflict in pcl2_to_scan CMakeLists.txt

Originally posted by paulbovbel with karma: 4518 on 2014-08-25

This answer was ACCEPTED on the original site

Post score: 1


Original comments

Comment by arenillas on 2014-08-25:
I solved it by changing my perception_pcl package from catkin_ws to ros_catkin_ws. Thank you

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.