Ask Your Question
0

Building Custom Message on Dashing Fails

asked 2019-09-13 01:24:11 -0500

Tim Craig gravatar image

updated 2019-09-13 17:51:19 -0500

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 ... (more)

edit retag flag offensive close merge delete

Comments

Can you provide more information? CMakeList, package.xml and so on

LeoE gravatar imageLeoE ( 2019-09-13 07:40:53 -0500 )edit

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.

tfoote gravatar imagetfoote ( 2019-09-13 15:16:31 -0500 )edit

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.

LeoE gravatar imageLeoE ( 2019-09-13 16:14:31 -0500 )edit

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.

Tim Craig gravatar imageTim Craig ( 2019-09-13 17:55:16 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2019-09-14 19:49:32 -0500

Tim Craig gravatar image

updated 2019-09-14 19:56:27 -0500

The problem stemmed from my .msg file beginning with a lower case letter. Change it to a capital and everything worked. I've searched and can't find where the file name for a .msg file must begin with a capital. This did not seem to be a requirement in ROS1 although a lot of examples did it.

In any event, it would be nice if this was made clearer and the response to a lower case beginning letter wasn't the message generator python program crashing and a simple error message indicating that was generated instead.

edit flag offensive delete link more

Comments

1

In any event, it would be nice if this was made clearer and the response to a lower case beginning letter wasn't the message generator python program crashing and a simple error message indicating that was generated instead.

I sympathise with you in that it took time to figure this out, and that it was unexpected, but the best way to make sure this either gets fixed (so case of filename doesn't matter any more), it gets documented better or the code dealing with this gets fixed (if this was actually more of a bug) would be for you to report this as an issue on the appropriate repository.

ROS Answers is not an issue tracker, and answers like this have very little visibility -- when used for reporting these sort of things.

gvdhoorn gravatar imagegvdhoorn ( 2019-09-15 04:37:36 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

3 followers

Stats

Asked: 2019-09-13 01:24:11 -0500

Seen: 33 times

Last updated: Sep 14