ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
1

How to specify the network interface ros2 uses for communication?

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

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
1

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

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 -0500 )edit

No, that was all that was needed for me

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

thanks very very much. I was using docker with ros2 (Ardupilot's SITL + mavros2 + ros2 in docker and my own script from the host! ) and I was really really confused by its behavior. I could send my messages with rqt and command line but my scripts wouldn't work. it took me about 2-3 days until I realized it's not my script's bug, QoS mismatch, docker's network bad config, mavros/mavlink bad behavior, etc! and suddenly solved everything!

antonyramsy gravatar image antonyramsy  ( 2022-02-05 08:00:35 -0500 )edit

Question Tools

2 followers

Stats

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

Seen: 4,664 times

Last updated: Apr 07 '21