Building Custom Message on Dashing Fails
When I run colcon build to generate a custom message on Dashing, I get the following error:
Starting >>> druai_msg
--- stderr: druai_msg
CMake Error at /opt/ros/dashing/share/rosidl_adapter/cmake/rosidl_adapt_interfaces.cmake:60 (message):
execute_process(/usr/bin/python3 -m rosidl_adapter --package-name druai_msg
--arguments-file
/home/brutusdev/ros2/test_ws/build/druai_msg/rosidl_adapter__arguments__druai_msg.json
--output-dir
/home/brutusdev/ros2/test_ws/build/druai_msg/rosidl_adapter/druai_msg
--output-file
/home/brutusdev/ros2/test_ws/build/druai_msg/rosidl_adapter/druai_msg.idls)
returned error code 1:
Traceback (most recent call last):
File "/usr/lib/python3.6/runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "/usr/lib/python3.6/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/opt/ros/dashing/lib/python3.6/site-packages/rosidl_adapter/__main__.py", line 19, in <module>
sys.exit(main())
File "/opt/ros/dashing/lib/python3.6/site-packages/rosidl_adapter/main.py", line 55, in main
pathlib.Path(relative_path), output_dir)
File "/opt/ros/dashing/lib/python3.6/site-packages/rosidl_adapter/__init__.py", line 20, in convert_to_idl
package_dir, package_name, interface_file, output_dir / 'msg')
File "/opt/ros/dashing/lib/python3.6/site-packages/rosidl_adapter/msg/__init__.py", line 28, in convert_msg_to_idl
msg = parse_message_string(package_name, input_file.stem, content)
File "/opt/ros/dashing/lib/python3.6/site-packages/rosidl_adapter/parser.py", line 522, in parse_message_string
msg = MessageSpecification(pkg_name, msg_name, fields, constants)
File "/opt/ros/dashing/lib/python3.6/site-packages/rosidl_adapter/parser.py", line 373, in __init__
pkg_name + PACKAGE_NAME_MESSAGE_TYPE_SEPARATOR + msg_name)
File "/opt/ros/dashing/lib/python3.6/site-packages/rosidl_adapter/parser.py", line 196, in __init__
raise InvalidResourceName(self.type)
rosidl_adapter.parser.InvalidResourceName: druai
Call Stack (most recent call first):
/opt/ros/dashing/share/rosidl_cmake/cmake/rosidl_generate_interfaces.cmake:130 (rosidl_adapt_interfaces)
CMakeLists.txt:24 (rosidl_generate_interfaces)
---
Failed <<< druai_msg [ Exited with code 1 ]
package.xml
<package format="3">
<name>druai_msg</name>
<version>0.7.3</version>
<description>Examples of custom message handling</description>
<maintainer email="TimCraig@Druai.com">Tim Craig</maintainer>
<license>Apache License 2.0</license>
<author>Tim Craig</author>
<buildtool_depend>ament_cmake</buildtool_depend>
<build_depend>builtin_interfaces</build_depend>
<build_depend>rosidl_default_generators</build_depend>
<exec_depend>builtin_interfaces</exec_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>
CMakeList.txt
cmake_minimum_required(VERSION 3.5)
project(druai_msg)
# Default to C++14
if(NOT CMAKE_CXX_STANDARD)
set(CMAKE_CXX_STANDARD 14)
endif()
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
add_compile_options(-Wall -Wextra -Wpedantic)
endif()
find_package(ament_cmake REQUIRED)
#find_package(rclcpp REQUIRED)
#find_package(std_msgs REQUIRED)
#Needed to handle custom messages
find_package(builtin_interfaces REQUIRED)
find_package(rosidl_default_generators REQUIRED)
#set(FastRTPS_INCLUDE_DIR:PATH /opt/ros/dashing/include)
#Generate the include file and other support for the custom message
rosidl_generate_interfaces(${PROJECT_NAME}
"msg/druai.msg"
DEPENDENCIES builtin_interfaces)
ament_package()
Message file druai.msg, not that it seems to get that far.
string banner
int32 count
I shifted my focus to ROS2 when Dashing was released. Seems to have installed correctly. I successfully built the standard examples. Successfully built and ran my own publisher-subscriber pair for standard messages. However, when I tried to do a custom message following this tutorial which is for Crystal, it failed. It appears that the FastRTPS include files and libraries are there in /opt/ros/dashing/.....
[Tutorial video](https://www.youtube.com/watch?v=nG3IOkEOPps)
When I searched, I found something ...
Can you provide more information? CMakeList, package.xml and so on
Please edit your question to add this content instead of stringing it out in comments. You can integrate it for easier reading with new viewers for future reference.
First of all, don't know, if it is a copy paste mistake, but there is a < missing in your package.xml at member_of_group. Now have you tried deleting your build (and install) folder and rebuilding? Is Our ros2 path sourced? And why do you have a dependency on "builtin_interfaces"? This is not a necessary package for your example, if I'm not mistaken.
Ok, the missing < in the package.xml was in the original. I moved the package to a pristine workspace and tried again. The error changed. I've updated the original question with the current error message and data. Appears to cause an error in the interface generation python code.