Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bind to non default interface #24

Closed

Conversation

garyservin
Copy link
Contributor

If you want to use something that isn't the default route ( e.g. Ethernet for internet, but WiFi for the multimaster network), you need to be able to specify the network to bind to. By default multimaster binds to the default interface and will not discover other masters in the case outlined above.

This PR addresses the previous use case and allows multimaster_fkie to bind to a non default interface by specifying the interface via a ROS param ('~interface') or by setting the ROS_IP envvar.

Some other changes introduced

  • added a second listener socket (unicast) to allow for unicast UDP traffic to be received, since we were unable to send unicast traffic with the same multicast socket.
  • Don't exit if we're on localhost, just log a warning
  • Added support for different logging levels in master_monitor: currently all logs are marked as warnings, where some should be marked as errors.

Mike O'Driscoll and others added 3 commits November 10, 2015 10:13
* Send to multicast address, not the interface address specified.
* Set interface IP via rosparam or ROS_IP
* Properly bind multicast send/receive to a specific interface
* Add new unicast/send receive socket as multicast socket is multicast only.
* Add extra receive thread for unicast socket to process.
* Don't exit if we're on localhost
@atiderko
Copy link
Member

Thanks for the pull request, @garyservin.
The possibility to specify an interface by ~interface parameter or by ROS_IP is already available since 0c7302d (XMLRPCServer listen on all address if it binds to 0.0.0.0)
Unfortunately it is neither documented in ROS wiki nor by launch file :-(

Your PR have some useful changes, like

  • Don't exit if we're on localhost, just log a warning
  • Added support for different logging levels in master_monitor: currently all logs are marked as warnings, where some should be marked as errors.

But it also removes the discovery functionality specified by ~robot_hosts. These robots are pinged using unicast communication because in some network environments multicast does not work properly.

Can you explain why you are unable to send unicast traffic with the same multicast socket?

regards
atiderko

atiderko added a commit that referenced this pull request Nov 11, 2015
Thanks to @garyservin for pull request #24:
* Don't exit if we're on localhost, just log a warning
* Added support for different logging levels in master_monitor:
currently all logs are marked as warnings, where some should be marked
as errors.

Other changes need to be verified
@mikeodr
Copy link
Contributor

mikeodr commented Nov 11, 2015

Hi @atiderko,

While trying to use the ~interface or ROS_IP parameters for attempting to bind to a specific interface I found that it wasn't working. After some deep diving with wireshark I had to fix how it actually bound to the interface here

A few use cases we found this helped address for us are:

  • Binding to a non-default interface. (wasn't working)
  • Logging changes to be more realistic.

Is there any documentation on the ~robot_hosts param, this may be of some use to us in the near future also if I am understanding it's functionality properly.

@atiderko
Copy link
Member

Hi @mikeodr,

there is currently no documentation how ~robot_hosts/discovering internally works.
When ~robot_hosts should be used:

  • the underlining network has no multicast support (e.g. LTE)

How it works:

  • ~robot_hosts is a list of remote hosts described by name or IP
  • in addition to multicast heartbeat an unicast message with request to send a heartbeat message by unicast will be sent to each host in ~robot_hosts
    • if a new request or a new heartbeat message (unicast or multicast) is received the master_discovery contacts the XMLRPCServer on sender host to get additional informations about remote ROS environment (masteruri, mastername, nodename). In most cases the masteruri contains the name of the host. This hostname should be resolved to the same IP (on local machine and on remote host)!
    • after the additional informations are received, the remote master_discovery is registered and is available through the published topic.
  • the unicast message with request is also sent if while a predefined interval of (ACTIVE_REQUEST_AFTER=60 sec) no heartbeats are received from remote host
    • this is useful in VLANs because some Linux hosts lost the group membership
    • it is also useful if heartbeats are deactivated to reduce network traffic
  • if heartbeats are deactivated (HEARTBEAT_HZ==0) multicast/unicast messages are sent on ROS -Master changes

I hope this helps to understand the discovery process with multicast and unicast messages.

Did you tried to change the default multicast route to a non default interface (in combination with current implementation of ~interface)?
Perhaps this document contain some hints for network configuration: http://www.iri.upc.edu/files/scidoc/1607-Multi-master-ROS-systems.pdf

I will also try to setup an environment with multiple interfaces and test the behavior again...

regards,
atiderko

@atiderko
Copy link
Member

Hi @mikeodr,
I reproduced the problem with non default interface. I try to integrate your solution.

regards,
atiderko

atiderko added a commit that referenced this pull request Nov 13, 2015
Thanks for creating the PR to @garyservin and @mikeodr!

The change lets you define an interface by `~interface`, `ROS_IP` envar
or append the interface to multicast group like
226.0.0.0@192.168.101.10. The master_discovery then binds to the
specified interface and creates also an unicast interface for active
requests on communication problems or if `~robot_hosts` are defined.

Now you can also disable the multicast communication by setting
`~send_mcast` to false. In this case the requests are send to hosts
defined in `~robot_hosts`.
@atiderko
Copy link
Member

Hi @mikeodr, @garyservin,

I've integrated your solution with some changes to be able to use the unicast in the currently used manner. Can you test it in your environment, please?

regards,
atiderko

@garyservin
Copy link
Contributor Author

@atiderko thanks for integrating the changes. I've tested and I can bind to a specific interface now.

Also, would you be able to release new version with these changes?

Thanks!

@garyservin garyservin closed this Nov 25, 2015
@atiderko
Copy link
Member

@garyservin thanks for tests and good news!

I will release the new version, but it will take a while before the public repositories are synchronized. Last sync was 7 days ago.

@paulbovbel
Copy link

@atiderko, if you wouldn't mind cutting a release, we can get it built and available on our public package server (packages.clearpathrobotics.com) for more immediate testing.

@atiderko
Copy link
Member

atiderko commented Dec 2, 2015

@paulbovbel I have no problem to release it also on your repository as long as it does not conflicts with public ros repositories. What do I have to do?

@paulbovbel
Copy link

Nothing needs doing, other than creating the tag you made. The newest version is now available on packages.clearpathrobotics.com, and we'll work it into our testing pipeline (FYI @garyservin)

clearpathrobotics/public-rosdistro@3d222eb

@atiderko
Copy link
Member

atiderko commented Dec 3, 2015

@paulbovbel thanks, that was easy and works well : -)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants