micro-ROS / docker

Docker-related material to setup, configure and develop with micro-ROS hardware.
https://micro-ros.github.io
Apache License 2.0
49 stars 29 forks source link

SHM with microros-agent #85

Closed aditya2592 closed 2 years ago

aditya2592 commented 2 years ago

Hi,

Both XML files in the entrypoint seem to be disabling SHM, is this actually needed? Shouldn't participants on same machine but in other docker containers still be able to talk to the agent using SHM?

Acuadros95 commented 2 years ago

Hi @aditya2592,

The shared memory directory (/dev/shm) is not shared between containers, that is why we disable it by default. To enable this communication, the directory should be mounted on your docker container: -v /dev/shm:/dev/shm.

aditya2592 commented 2 years ago

Thanks @Acuadros95, so to confirm, if we mount those folders to our container and to the agent container, then there is no reason to use UDP to communicate between them? Will I be able to use an XML config with purely SHM as transport:

<?xml version="1.0" encoding="UTF-8" ?>
<dds>
    <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="super_client_profile" is_default_profile="true">
            <rtps>
                <!-- Link the Transport Layer to the Participant -->
                <userTransports>
                    <transport_id>shm_transport</transport_id>
                </userTransports>
                <useBuiltinTransports>false</useBuiltinTransports>
            </rtps>
        </participant>
    </profiles>
</dds>
Acuadros95 commented 2 years ago

Yes, you have to modify the FASTRTPS_DEFAULT_PROFILES_FILE file of course.