ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

Unknown CMake command "rosidl_generate_interfaces"

asked 2022-06-11 14:47:24 -0500

adroit.levees.0r gravatar image

I'm following this tutorial: Creating custom ROS 2 msg and srv files

I have the following error when I run colcon build --packages-select tutorial_interfaces:

Starting >>> tutorial_interfaces
--- stderr: tutorial_interfaces                         
CMake Error at CMakeLists.txt:25 (rosidl_generate_interfaces):
  Unknown CMake command "rosidl_generate_interfaces".


---
Failed   <<< tutorial_interfaces [0.25s, exited with code 1]

Summary: 0 packages finished [0.42s]
  1 package failed: tutorial_interfaces
  1 package had stderr output: tutorial_interfaces

I have this CMakeLists.txt:

cmake_minimum_required(VERSION 3.8)
project(tutorial_interfaces)

if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
  add_compile_options(-Wall -Wextra -Wpedantic)
endif()

# find dependencies
find_package(ament_cmake REQUIRED)
# uncomment the following section in order to fill in
# further dependencies manually.
# find_package(<dependency> REQUIRED)

if(BUILD_TESTING)
  find_package(ament_lint_auto REQUIRED)
  # the following line skips the linter which checks for copyrights
  # uncomment the line when a copyright and license is not present in all source files
  #set(ament_cmake_copyright_FOUND TRUE)
  # the following line skips cpplint (only works in a git repo)
  # uncomment the line when this package is not in a git repo
  #set(ament_cmake_cpplint_FOUND TRUE)
  ament_lint_auto_find_test_dependencies()
endif()

rosidl_generate_interfaces(${PROJECT_NAME}
  "msg/Num.msg"
  "srv/AddThreeInts.srv"
)

ament_package()

find_package(rosidl_default_generators REQUIRED)

I have this package.xml:

<?xml version="1.0"?>
<?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
<package format="3">
  <name>tutorial_interfaces</name>
  <version>0.0.0</version>
  <description>Description</description>
  <maintainer email="email@gmail.com">My Name</maintainer>
  <license>Apache License 2.0</license>

  <buildtool_depend>ament_cmake</buildtool_depend>

  <test_depend>ament_lint_auto</test_depend>
  <test_depend>ament_lint_common</test_depend>

  <build_depend>rosidl_default_generators</build_depend>

  <exec_depend>rosidl_default_runtime</exec_depend>

  <member_of_group>rosidl_interface_packages</member_of_group>

  <export>
    <build_type>ament_cmake</build_type>
  </export>
</package>

Other information:

  • Ubuntu 20.04
  • VSCode (CMake extension on)
  • I'm new to CMake
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2022-06-13 23:54:30 -0500

qilin_gundamenjoyer gravatar image

CMakeLists.txt:
find_package(rosidl_default_generatorss REQUIRED) should be right under the #find_dependencies section and before rosidl_generate_interfaces(${PROJECT_NAME} "msg/Num.msg" "srv/AddThreeInts.srv". It should not be at the last line.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2022-06-11 14:47:24 -0500

Seen: 2,697 times

Last updated: Jun 13 '22