ROS2 .msg equivalent for nested modules in .idl

asked 2021-09-21 00:20:05 -0500

goksankobe gravatar image

updated 2021-09-21 00:22:03 -0500

Hi,

I'm trying to interface some of our native DDS applications with ROS2 subscribers. As redefining the DDS IDL interfaces are not an option currently, I'm exploring a solution from the ROS2 side.

We have the following structure in the .idl files:

module top_level {
  module middle_level {
     module  lower_level {
           module lowest_level {
                  struct myType {
                        int64 field_1;
                        int64 field_2;
                        int64 field_3;
                   };
           };
    };
  };
};

My first approach was to replicate the module hierarchy above in the folder structure for the ROS2 package. However, when I look at the generated .idl files by ROS, I see 2 issues:

1) No matter how many nested folders I create ROS2 only generates 2 modules: 1 top level module for the package name, and an inner module called "msg"

2) I do not have "msg" field in the IDL files, but the inner module from ROS always seems to be "msg".

I believe there will be other issues like ROS2 not allowing camel case message as field names, but that is a separate issue I believe.

Creating a "ROS2 .msg clone" for the native .idl files is just the first solution that came to my mind. If there is a better option to interface native DDS applications with ROS2 applications, I'm open to suggestions.

Thanks

Goksan

edit retag flag offensive close merge delete

Comments

Hi, has there been a solution to this?

From my experiments I saw that parts of the code generator use the folder structure to build such a hierarchy of modules/namespaces. However, the code generation fails anyways, since in the cmake scripts the folder between base path and first parent folder goes missing. https://github.com/ros2/rosidl/blob/d...

At this point I am wondering, whether such idl module nesting is even supported by the ros build architecture? At least according to the design specification/goals of ros2 it seems like it should be supported. https://design.ros2.org/articles/idl_...

simmue gravatar image simmue  ( 2022-11-08 07:07:19 -0500 )edit

Unfortunately I have not found a workaround, or seen anyone going deeper than 2 nested levels. I believe its a limitation in the ROS design. In the design document you linked, they mention 1st and 2nd level but don't say anything explicity about possibility of other levels.

goksankobe gravatar image goksankobe  ( 2022-12-10 03:17:56 -0500 )edit