cyclonedds icon indicating copy to clipboard operation
cyclonedds copied to clipboard

ros2 humble publisher and cyclone dds subscriber

Open victor-velezmoro opened this issue 2 years ago • 1 comments

Hey, i am trying to implement a chain of ros2 humble subscriber and publisher which in the end publish to a native cyclone-dds subscriber which then again publishes to a cyclone-dds subscriber(Goal: measure the message time it takes to pass all nodes). I have finished the parts where only humble or cyclone-dds is used, but I failed to communicate between the ros2 publisher and the follow-up cyclone-dds subscriber.

I am publishing a string and therefor use <std_msgs::msg::String>in humble. In cyclone-dds i am currently using the default example(https://cyclonedds.io/docs/cyclonedds/latest/getting_started/helloworld/helloworld_building.html) and therefor use the HelloWorldData_Msg_desc created by HelloWorldData.idl

module HelloWorldData
{
    struct Msg
    {
        @key long userID;
        string message;
    };
};

They have a different message type and my question is now if it is smarter to modify the message in ros2 humble or the receiving cyclone dds message? I am not sure how it works with .msg, .idl and the rosidl_generator_dds_idl and how they communicate with each other. Do I manually have to convert the .msg into .idl?

Can somebody please help me with this or provide some useful links I can check out.

PS: I always used rmw_cyclonedds_cpp as my middleware.

In these images you can see the publisher in humble (rt/sensor_data) and the subscriber in cyclone dds (/sensor_data)

image image

victor-velezmoro avatar Jul 15 '23 13:07 victor-velezmoro

Could fix it with an .idl file in cyclone dds looking like this:

module std_msgs {
    module msg {
        module dds_ {
            struct String_ {
                string data;
            };
        };
    };
};

which matches perfectly the message type of the publisher. Did not actively run the idlc command.

victor-velezmoro avatar Jul 17 '23 12:07 victor-velezmoro