Ask Your Question
2

Is it possible to use shared memory as IPC on ROS2 foxy?

asked 2020-09-17 06:35:57 -0600

nyquist09 gravatar image

We would like to compare different DDS vendors for ROS2. We have been using ROS1 so far and instrumented some processes to communicate over shared memory for performance reasons.

As I understood, both FastRTPS/FastDDS and CycloneDDS have or plan to have support for shared memory as IPC. Is anybody aware of what the state of the support is? And if it is supported, can it be used via the ROS middleware layer and how?

edit retag flag offensive close merge delete

Comments

You can find here for FastDDS: https://fast-dds.docs.eprosima.com/en...

lukicdarkoo gravatar image lukicdarkoo  ( 2020-09-18 16:02:54 -0600 )edit
1

That's what I have found and got to run in a standalone DDS application. But is it exposed via RMW? How can I have two ROS processes communicating via shared memory when using the RMW?

nyquist09 gravatar image nyquist09  ( 2020-09-21 01:39:21 -0600 )edit

I am facing the same problem as you. I try to use the FastRTPS shared memory. If you look at this discourse post, it's said that Shared Memory is now ready to be used in FastRTPS in Foxy. In this gitub PR on rmw_fastrps, Miguel said that SHM is enabled by default.

I compiled foxy on my computer and when I send topics I can see them passing through the UDP loop back in wireshark.

The FastRTPS documentation say that Shared Memory is disabled by default. I tried to set a custom profile.xml file thanks to the environment variable FASTRTPS_DEFAULT_PROFILES_FILE to enable SHM, but it don't seems to work (I still see messages in wireshark).

So if someone know how to enable this feature, feel free to help us !

Adrien BARRAL gravatar image Adrien BARRAL  ( 2020-09-23 06:42:38 -0600 )edit
1

As I already answered here, you need to add is_default_profile="true" on the profile defined in the XML, otherwise ROS 2 will not take the profile into account.

Miguel Company gravatar image Miguel Company  ( 2020-10-02 02:40:51 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2020-10-02 06:04:06 -0600

Adrien BARRAL gravatar image

Ok, so by aggregating comments from Miguel and Lukic, I successfully validate that DDS can be used with foxy.

To do so, you have to create an XML file called for example shm_profile.xml which will contains :

<?xml version="1.0" encoding="UTF-8" ?>
<profiles xmlns="http://www.eprosima.com/XMLSchemas/fastRTPS_Profiles">
    <transport_descriptors>
        <!-- Create a descriptor for the new transport -->
        <transport_descriptor>
            <transport_id>shm_transport</transport_id>
            <type>SHM</type>
        </transport_descriptor>
    </transport_descriptors>

    <participant profile_name="SHMParticipant" is_default_profile="true">
        <rtps>
            <!-- Link the Transport Layer to the Participant -->
            <userTransports>
                <transport_id>shm_transport</transport_id>
            </userTransports>
        </rtps>
    </participant>
</profiles>

Then, if you export the two environments variables :

export FASTRTPS_DEFAULT_PROFILES_FILE=`pwd`/shm_profile.xml RMW_IMPLEMENTATION=rmw_fastrtps_cpp

When you run two nodes that communicate on the same computer, you can observe in Wireshark that there are really few RTSP messages.

Now we can do latency, and bandwidth measurement, but that's another story !

edit flag offensive delete link more

Your Answer

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

Add Answer

Question Tools

5 followers

Stats

Asked: 2020-09-17 06:35:57 -0600

Seen: 1,164 times

Last updated: Oct 02 '20