Ask Your Question
1

How to specify the network interface ros2 uses for communication?

asked 2021-03-02 10:39:00 -0600

Hakaishin gravatar image

When I launch my node, after installing a docker image, I get following warning, luckily it arbitrarily selects the right interface, but how can I specify it to get rid of the warning? [od-1] 1614701696.982410 [0] od: using network interface eno1 (udp/192.168.254.20) selected arbitrarily from: eno1, docker0, br-ab6309382a59, tun0I'm using Ros2 build from source master and ros2 branches. I found: https://answers.ros.org/question/2999... and I was wondering if this applies in my case? I didn't find much information and before reading the extensive fast dds api to figure out how to set it, I ask here to make sure, this would even be a solution to my problem and if there is a new(set it directly by ros2) way to specify the network instead of going and fiddling with the default implementation.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2021-04-07 06:16:11 -0600

Hakaishin gravatar image

Create a file like this: example.xml and launch the node with following command: FASTRTPS_DEFAULT_PROFILES_FILE=<path/to/xml/example.xml> RMW_IMPLEMENTATION=rmw_fastrtps_cpp ros2 launch my_node file.launch

<?xml version="1.0" encoding="UTF-8" ?>
<profiles xmlns="http://www.eprosima.com/XMLSchemas/fastRTPS_Profiles">
    <transport_descriptors>
        <transport_descriptor>
            <transport_id>CustomUDPTransport</transport_id>
            <type>UDPv4</type>
            <interfaceWhiteList>
                <address>enp3s0</address>
            </interfaceWhiteList>
        </transport_descriptor>
    </transport_descriptors>
    <participant profile_name="CustomUDPTransportParticipant">
        <rtps>
            <userTransports>
                <transport_id>CustomUDPTransport</transport_id>
            </userTransports>
        </rtps>
    </participant>
</profiles>
edit flag offensive delete link more

Comments

Hi, I tried your proposed solution, but it does not not send the data over the specified interface. Do we have to change something inside the pub/sub code? https://fast-rtps.docs.eprosima.com/e...

omair50 gravatar image omair50  ( 2021-05-10 04:11:40 -0600 )edit

No, that was all that was needed for me

Hakaishin gravatar image Hakaishin  ( 2021-08-25 02:53:14 -0600 )edit

Your Answer

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

Add Answer

Question Tools

2 followers

Stats

Asked: 2021-03-02 10:39:00 -0600

Seen: 886 times

Last updated: Apr 07