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

Is it possible to assign dedicated ethernet port to the specific topics?

asked 2020-02-17 00:58:30 -0500

wlee gravatar image

Currently, I'm considering below multi-machine setup using ros1.

image description

Description:

  • The publisher machine publishes 6 topics to the subscriber machine

  • Both of the publisher/subscriber machines have two ethernet interface(eth0~1)

  • I want to publish topic 1~3 through eth0, and topic 4~6 through eth1

The reason why I'm considering the above setup is

  • The size/frequency of topics is so large that the latency is not tolerable when it's transmitted through the one interface

Could you possibly clarify whether the above setup in ros1 is possible or not?

edit retag flag offensive close merge delete

Comments

Related/duplicate: #q311530.

And I believe it would be good to mention your previous question (as it's highly related): #q343874.

Finally: could you give an example of the kinds of traffic that you are dealing with? Assuming regular gbit/s network infrastructure, you must have either a lot of subscribers or some very high bw traffic. Perhaps even a very fast, lossless compression algorithm (example: swri-robotics/imagezero_transport, but there are others) might already remove the bottleneck.

gvdhoorn gravatar image gvdhoorn  ( 2020-02-17 02:07:26 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2020-02-17 02:30:37 -0500

gvdhoorn gravatar image

updated 2020-02-17 03:12:13 -0500

For a basic setup I would say, no, this isn't possible. Topics are sent peer-to-peer over regular TCP and UDP connections. Ports used are chosen "randomly" by your OS, from the ephemeral range (on Linux at least). Nodes (in ROS 1) don't have any control over this.

This makes it very difficult to create a configuration like you show, as there is essentially no easy way to either:

  • force topics to be only published over certain IPs and/or ports
  • determine which IPs/ports are used for certain topics

As a 'trick' (and untested):

  1. use a 'channel' configuration wrt topics, instead of the normal 'bus' (ie: use dedicated topics to 'connect' single publisher-subscriber pairs, and give each pair its own topic)
  2. make sure you have a 1-to-1 ratio of topic-to-NIC
  3. force a node (ie: subscriber) to bind(..) to a certain NIC (or really: IP, and have different IPs per NIC)
  4. setup routing on publisher(s) to route traffic for certain IPs/networks over certain NICs

Now if #3 is made true (and there are ways to do this), subscribers will only use a specific IP as their originating IP. Publishers will initiate data connections to those IPs. The ports don't matter any more, as we use IPs to separate traffic in this setup (which is nice, as we can control IPs, we can't control ports).

As publishers will see requests for certain topics come from specific IPs, and their routing tables have been setup such that they route traffic for those IPs over specific NICs, you should end up in a situation where certain topics are only published over certain NICs.

But do note the difference with what you are asking: this is not something we can configure ROS to "do for us". We need to configure the OS and our application (ie: ROS nodes) in such a way that the resultant behaviour is what you're after.


A more advanced alternative (so more work, but less IPs needed and more automated): snoop the traffic between the ROS master and nodes (it's basic XML-RPC). Learn which topics are published over which TCP/UDP ports to which subscribers. Now use iptables to tag traffic over those ports and then route it over specific interfaces based on those tags (with ip's fwmark support). Something like this SO question. But this is a bit more complex than the setup I described earlier and interposing routing based on traffic tags may negatively influence performance.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2020-02-17 00:58:30 -0500

Seen: 339 times

Last updated: Feb 17 '20