I am using Windows 10 as my operating system, and I am following the ROS2 humble tutorial on creating custom msg and srv files:
https://docs.ros.org/en/humble/Tutorials/Beginner-Client-Libraries/Custom-ROS2-Interfaces.html
I have edited the CMakeLists.txt and the package.xml file. However, when I built the tutorial_interfaces, it failed without any error message. Did I miss any step? Thanks very much.
The contents of the files and the steps for building are as follows:
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)
find_package(geometry_msgs REQUIRED)
find_package(rosidl_default_generators REQUIRED)
rosidl_generate_interfaces(${PROJECT_NAME}
"msg/Num.msg"
"msg/Sphere.msg"
"srv/AddThreeInts.srv"
DEPENDENCIES geometry_msgs # Add packages that above messages depend on, in this case geometry_msgs for Sphere.msg
)
ament_package()
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>TODO: Package description</description>
<maintainer email="[email protected]">user</maintainer>
<license>Apache-2.0</license>
<buildtool_depend>ament_cmake</buildtool_depend>
<depend>geometry_msgs</depend>
<buildtool_depend>rosidl_default_generators</buildtool_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>
the steps for building:
c:\dev\ros2_ws>call C:\dev\ros2_humble\local_setup.bat
"[rti_connext_dds_cmake_module][warning] RTI Connext DDS environment script not found (\resource\scripts\rtisetenv_x64Win64VS2017.bat). RTI Connext DDS will not be available at runtime, unless you already configured PATH manually."
c:\dev\ros2_ws>colcon build --merge-install --packages-select tutorial_interfaces
Starting >>> tutorial_interfaces
--- stderr: tutorial_interfaces
CMake Warning (dev) at C:/dev/ros2_humble/share/rosidl_generator_py/cmake/rosidl_generator_py_generate_interfaces.cmake:20 (find_package):
Policy CMP0148 is not set: The FindPythonInterp and FindPythonLibs modules
are removed. Run "cmake --help-policy CMP0148" for policy details. Use
the cmake_policy command to set the policy and suppress this warning.
Call Stack (most recent call first):
C:/dev/ros2_humble/share/ament_cmake_core/cmake/core/ament_execute_extensions.cmake:48 (include)
C:/dev/ros2_humble/share/rosidl_cmake/cmake/rosidl_generate_interfaces.cmake:286 (ament_execute_extensions)
CMakeLists.txt:13 (rosidl_generate_interfaces)
This warning is for project developers. Use -Wno-dev to suppress it.
CMake Warning (dev) at C:/dev/ros2_humble/share/python_cmake_module/cmake/Modules/FindPythonExtra.cmake:52 (find_package):
Policy CMP0148 is not set: The FindPythonInterp and FindPythonLibs modules
are removed. Run "cmake --help-policy CMP0148" for policy details. Use
the cmake_policy command to set the policy and suppress this warning.
Call Stack (most recent call first):
C:/dev/ros2_humble/share/rosidl_generator_py/cmake/rosidl_generator_py_generate_interfaces.cmake:23 (find_package)
C:/dev/ros2_humble/share/ament_cmake_core/cmake/core/ament_execute_extensions.cmake:48 (include)
C:/dev/ros2_humble/share/rosidl_cmake/cmake/rosidl_generate_interfaces.cmake:286 (ament_execute_extensions)
CMakeLists.txt:13 (rosidl_generate_interfaces)
This warning is for project developers. Use -Wno-dev to suppress it.
CMake Warning (dev) at C:/dev/ros2_humble/share/python_cmake_module/cmake/Modules/FindPythonExtra.cmake:140 (find_package):
Policy CMP0148 is not set: The FindPythonInterp and FindPythonLibs modules
are removed. Run "cmake --help-policy CMP0148" for policy details. Use
the cmake_policy command to set the policy and suppress this warning.
Call Stack (most recent call first):
C:/dev/ros2_humble/share/rosidl_generator_py/cmake/rosidl_generator_py_generate_interfaces.cmake:23 (find_package)
C:/dev/ros2_humble/share/ament_cmake_core/cmake/core/ament_execute_extensions.cmake:48 (include)
C:/dev/ros2_humble/share/rosidl_cmake/cmake/rosidl_generate_interfaces.cmake:286 (ament_execute_extensions)
CMakeLists.txt:13 (rosidl_generate_interfaces)
This warning is for project developers. Use -Wno-dev to suppress it.
---
Failed <<< tutorial_interfaces [8.59s, exited with code 1]
Summary: 0 packages finished [9.14s]
1 package failed: tutorial_interfaces
1 package had stderr output: tutorial_interfaces
c:\dev\ros2_ws>
2023/12/28 update:
Thanks for ExSystem's suggestion very much. I found the following error message in the "stdout_stderr.log" file:
File "C:\dev\ros2_humble\Lib\site-packages\rosidl_parser\parser.py", line 20, in <module>
from lark import Lark
ModulenotfoundError No module named 'Lark'
Then I followed the solution provided in this issue by using the 'pip3 install lark' command to install the Lark module.
After successfully installing the Lark module and rebooting my computer, I checked its installation status with the following command:
c:\dev\ros2_ws>pip3 install lark
Requirement already satisfied: lark in c:\python38\lib\site-packages (1.1.8)
Despite installing the Lark module, the building process for the "tutorial_interfaces" continued to fail, and I encountered the same error message in the stdout_stderr.log file.
Additionally, I ensured that before rebuilding "tutorial_interfaces", I deleted the 'build', 'install', and 'log' folders in the workspace.
Could the method used for solving the err message be incorrect? Thank you very much for your assistance.