fkie / multimaster_fkie

ROS stack with FKIE packages for multi-robot (discovering, synchronizing and management GUI)
BSD 3-Clause "New" or "Revised" License
268 stars 108 forks source link

Bind to non default interface #24

Closed garyservin closed 8 years ago

garyservin commented 8 years ago

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

atiderko commented 8 years ago

Thanks for the pull request, @garyservin. The possibility to specify an interface by ~interface parameter or by ROS_IP is already available since https://github.com/fkie/multimaster_fkie/commit/0c7302dfaa57557039423360378bf41043e790ea (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

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

mikeodr commented 8 years ago

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:

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 commented 8 years ago

Hi @mikeodr,

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

How it works:

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 commented 8 years ago

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

regards, atiderko

atiderko commented 8 years ago

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 commented 8 years ago

@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!

atiderko commented 8 years ago

@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 commented 8 years ago

@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 commented 8 years ago

@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 commented 8 years ago

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)

https://github.com/clearpathrobotics/public-rosdistro/commit/3d222eb90b05d53b909cba9282f06006957bfbaf

atiderko commented 8 years ago

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