ROS2 services not using ament_cmake

asked 2019-12-13 14:20:14 -0500

mikepark93 gravatar image

I am not using ament_cmake and I am having trouble incorporating the .srv files to the CMakeLists.txt. When I do find_package(rosidl_default_generator_cpp REQUIRED) It is throwing me a CMake Error:

[cmake]   Could not find a package configuration file provided by
[cmake]   "rosidl_default_generator_cpp" with any of the following names:
[cmake]     rosidl_default_generator_cppConfig.cmake
[cmake]     rosidl_default_generator_cpp-config.cmake

Likewise, it is saying that the following command is not a cmake command :


Any help would be greatly appreciated!

edit retag flag offensive close merge delete


Have you declared the dependency on rosidl_default_generator_cpp in your package.xml file?

Dirk Thomas gravatar image Dirk Thomas  ( 2019-12-13 14:41:39 -0500 )edit

I am not using colon as my build tool in my application. I am using cmake for everything and have been manually linking the ros2 libraries. I have no package.xml

mikepark93 gravatar image mikepark93  ( 2019-12-13 14:47:04 -0500 )edit

Then you need to make sure rosidl_default_generator_cpp is findable by CMake, e.g. by setting the appropriate CMAKE_PREFIX_PATH.

Dirk Thomas gravatar image Dirk Thomas  ( 2019-12-13 14:50:15 -0500 )edit

How would I do that? Do I just point it to /opt/ros/dashing (I am using dashing as my distro)

mikepark93 gravatar image mikepark93  ( 2019-12-16 08:18:32 -0500 )edit

Setting the CMAKE_PREFIX_PATH resolved the previous issue, but I am getting another issue now.

[cmake] Found PythonInterp: /usr/bin/python3 (found version "3.6.9") 
[cmake] CMake Error at /opt/ros/dashing/share/rosidl_typesupport_c/cmake/get_used_typesupports.cmake:28 (message):
[cmake]   No RMW implementations found
[cmake] Call Stack (most recent call first):
[cmake] /opt/ros/dashing/share/rosidl_typesupport_c/cmake/rosidl_typesupport_c_generate_interfaces.cmake:65 (get_used_typesupports)
[cmake]   /opt/ros/dashing/share/ament_cmake_core/cmake/core/ament_execute_extensions.cmake:48 (include)
[cmake]   /opt/ros/dashing/share/rosidl_cmake/cmake/rosidl_generate_interfaces.cmake:286 (ament_execute_extensions)
[cmake]   src/common/sensor_ros2wrapper/CMakeLists.txt:84 (rosidl_generate_interfaces)
mikepark93 gravatar image mikepark93  ( 2019-12-16 16:12:41 -0500 )edit