Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using 'rosidl_generate_dds_interfaces' cmake module does not generate any IDL file #48

Closed
TSC21 opened this issue Dec 16, 2018 · 12 comments

Comments

@TSC21
Copy link

TSC21 commented Dec 16, 2018

Required Info:

  • Operating System:
    • Ubuntu 18.04
  • Installation type:
    • binaries
  • DDS implementation:
    • Fast-RTPS

Steps to reproduce issue

Hi,

I am trying to use this package to generate DDS IDL files from ROS messages. I know that rmw_fastrtps_cpp is different since it uses introspection rather than generated code specific to each message so for FastRTPS, which results on one not having to generate .idl files. Though, for my particular case, I do require the IDL's to be generated in order to generate code for a micro-RTPS agent daemon.

The following snippet is what I am adding to the CMakeLists.txt file:

rosidl_generate_dds_interfaces("${PROJECT_NAME}_fastrtps_idl"
  IDL_FILES ${MSGS}
  DEPENDENCY_PACKAGE_NAMES ${PROJECT_NAME} builtin_interfaces
  OUTPUT_SUBFOLDERS "dds_fastrtps"
)

Where MSGS are the list of ROS msgs inside package_dir/msg. I use dds_fastrtps since it's the same naming for the output folder of the OpenSplice IDL files.

Expected behavior

The expected behaviour, of course, is that the IDL files get generated, so they can be used.

Actual behavior

It's verified that rosidl_generator_dds_idl__dds_fastrtps__arguments.json is created under the build folder, though no build/<project_name>/rosidl_generator_dds_idl/<project_name>/msg/dds_fastrpts directory is created, which results on having an error on the install process:

CMake Error at ament_cmake_symlink_install/ament_cmake_symlink_install.cmake:158 (message):
  ament_cmake_symlink_install_files() can't find
  '/home/nuno/PX4/px4_ros_com_ros2/build/px4_ros_com/rosidl_generator_dds_idl/px4_ros_com/msg/dds_fastrtps/ActuatorArmed_.idl'
Call Stack (most recent call first):
  ament_cmake_symlink_install/ament_cmake_symlink_install.cmake:314 (ament_cmake_symlink_install_files)
  cmake_install.cmake:41 (include)


Makefile:61: recipe for target 'install' failed
make: *** [install] Error 1
--- stderr: px4_ros_com

Thanks in advance for your support!

@TSC21
Copy link
Author

TSC21 commented Dec 18, 2018

@nuclearsandwich @dirk-thomas can I get your feedback here? Thanks!

@nuclearsandwich
Copy link
Member

Installation type:
* binaries

Are you referring here to the Debian packages or the provided archive builds? Bouncy or Crystal?

I know that rmw_fastrtps_cpp is different since it uses introspection rather than generated code specific to each message so for FastRTPS

I'm not sure that this is still the case in Crystal. I thought that ros2/rmw_fastrtps#218 switched rmw_fastrtps_cpp to default to static typesupport.

As far as the build error itself: I am not very familar with the IDL pipeline but if you share a link to the source for the package you're building I can try to reproduce the failure.

@TSC21
Copy link
Author

TSC21 commented Dec 18, 2018

Are you referring here to the Debian packages or the provided archive builds? Bouncy or Crystal?

Debian package for Bouncy.

I'm not sure that this is still the case in Crystal. I thought that ros2/rmw_fastrtps#218 switched rmw_fastrtps_cpp to default to static typesupport.

I am using Bouncy it seems to be the case still.

As far as the build error itself: I am not very familar with the IDL pipeline but if you share a link to the source for the package you're building I can try to reproduce the failure.

Sure thing: https://github.com/PX4/px4_ros_com. Though the above snippet needs to be added bellow https://github.com/PX4/px4_ros_com/blob/master/CMakeLists.txt#L48. The package does have rosidl_generate_interfaces() generating the IDL's for OpenSplice, but it's required it does it to Fast RTPS so one does not have the requirement for the opensplice rmw.

Thanks for the feedback and waiting for your testing results.

Note: a similar problem was reported in https://answers.ros.org/question/268396/ros2-generating-dds-idl-files-from-msg-ros-message-format/

@TSC21
Copy link
Author

TSC21 commented Dec 19, 2018

@nuclearsandwich for a straightforward test and to reproduce:

  1. Clone https://github.com/PX4/px4_ros_com to a ROS2 workspace;

  2. Add:

rosidl_generate_dds_interfaces("${PROJECT_NAME}_fastrtps_idl"
  IDL_FILES ${ROS_UORB_MSGS}
  DEPENDENCY_PACKAGE_NAMES ${PROJECT_NAME} builtin_interfaces
  OUTPUT_SUBFOLDERS "dds_fastrtps"
)

under https://github.com/PX4/px4_ros_com/blob/master/CMakeLists.txt#L48.

  1. Build it using the scripts/build_ros2_workspace.bash script or manually using colcon build --symlink-install --event-handlers console_direct+.

  2. After a while, and in the install process, you will get an error similar to the described.

@TSC21
Copy link
Author

TSC21 commented Dec 22, 2018

@nuclearsandwich any inputs? Thanks!

@nuclearsandwich
Copy link
Member

Thanks for the reproduction steps @TSC21. Unfortunately I haven't yet had a chance to try them yet.

Off the top of my head I'm not sure that Bouncy generates IDL for Fast-RTPS under any circumstances. I believe your options will be to generate IDL from the OpenSplice or Connext RMW providers or try using Crystal and leveraging the static typesupport pipeline for Fast-RTPS.

@TSC21
Copy link
Author

TSC21 commented Dec 22, 2018

Thanks for the reproduction steps @TSC21. Unfortunately I haven't yet had a chance to try them yet.

No problem. Please, when you have time, try to reproduce it. I think it's critical to try to understand what's happening with rosidl_generate_dds_interfaces() CMake function. Thanks!

Off the top of my head I'm not sure that Bouncy generates IDL for Fast-RTPS under any circumstances. I believe your options will be to generate IDL from the OpenSplice or Connext RMW providers or try using Crystal and leveraging the static typesupport pipeline for Fast-RTPS.

But wasn't rosidl_generate_dds_interfaces() supposed to generate IDL's for any DDS rmw? I was expecting this to be true for all releases by now. Why is it different from Bouncy to Crystal? Support Crystal, right now, is not in my plans. I just wanted to have the rosidl_generate_dds_interfaces() to do what it was meant for, as it doesn't seem to do it currently.

@dirk-thomas
Copy link
Member

The following snippet is what I am adding to the CMakeLists.txt file:

The function rosidl_generate_dds_interfaces uses the CMake functions add_custom_command and add_custom_target internally. CMake will not invoke the command until you build a target which actually depends on the files declared as OUTPUT of the custom command or on the custom target. So you can't expect the function to "synchronously" create the .idl files for you if nothing needs t. Instead you need to make sure the target is actually being invoked. An example how an existing package does that: https://github.com/ros2/rosidl_typesupport_opensplice/blob/f6a985a1d406811806c5075aac8392e8d0ab06d5/rosidl_typesupport_opensplice_cpp/cmake/rosidl_typesupport_opensplice_cpp_generate_interfaces.cmake#L184-L187

But wasn't rosidl_generate_dds_interfaces() supposed to generate IDL's for any DDS rmw?

No, unfortunately different vendors still require slightly different versions of .idl files due to their usage / support of special cases like pragmas, annotations etc. As a consequence each typesupport package which needs .idl files as input invokes this CMake function to generate .idl files only for its own consumption.

I will go ahead and close this ticket since the problem is in the way the function is being used. Please feel free to continue commenting.

@TSC21
Copy link
Author

TSC21 commented Dec 31, 2018

@dirk-thomas thanks for the suggestion. I was able to generate the IDL files after setting up the proper dependencies of the target with respect to the IDL file list.

@TSC21
Copy link
Author

TSC21 commented Jan 18, 2019

@dirk-thomas I know this issue is close but this is still a related question: I see that the <package_name>_INTERFACE_FILES macro is exported as CMake configuration extra. Though I can see that this only exports the the relative path of the msg/IDL files, while I would like to obtain the absolute path considering where the package is installed, so I can use them on another package. Is there a straight easy way of doing it? Or do I have to build an absolute path from <package_name>_DIR?
Thanks again

@dirk-thomas
Copy link
Member

Or do I have to build an absolute path from <package_name>_DIR?

Yes, you should construct the absolute path based on this one.

@TSC21
Copy link
Author

TSC21 commented Jan 18, 2019

Ok thanks found a solution by using get_filename_component().

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants