Zeroconf is a set of network protocols that provide automatic discovery of network resources. This package provides tools to announce the availability of the ROS Master and to locate ROS Master nodes on the local network. This package uses Avahi to implement Zeroconf. Avahi is installed by default on many Linux distributions. Compatibility with MacOS may be possible in the future, and patches are greatly appreciated.

Any feedback on this package would be useful, as automatic discovery of robots connected to the local network will be a needed for some applications in the near future.


Install the ihr_tools stack.

   1 cd ~/ros/stacks
   2 git clone git://
   3 cd iheart-ros-pkg/ihr_tools
   4 rosdep install zeroconf
   5 rosmake zeroconf

For the lazy or reckless, the following should update all the config files correctly on Ubuntu 10.04. There is currently no guarantee this will work and it might delete your computer.

   1 make install

Service types

Avahi does not currently support ROS service types and the build script isn't installed by default.

The following commands will install updated files if you have not modified them, if you have previously modified these files you should know what to do. In the future a patch needs to be sent to the Avahi maintainers.

Additional translations or corrections are welcome.

   1 cp `rospack find zeroconf`/config/service-types /usr/share/avahi/service-types
   2 cp `rospack find zeroconf`/config/service-types.db /usr/lib/avahi/service-types.db 


While not required, this is a useful GUI tool for using zeroconf. It can be installed on Ubuntu 10.04 by running the following and right clicking the top panel and selecting add to panel.

   1 sudo aptitude install service-discovery-applet

The service-discovery-applet does not support ROS service types by default, however the following command will add support.

   1 gconftool --load `rospack find zeroconf`/config/service-discovery-applet.xml


At this point there are three primary methods for using zeroconf at this point. In the future, it may be worth looking at integrating this functionality into rosmaster.

Launch File

The easiest option is to add a zeroconf node to the launch file of the master. The obvious downside to this approach is that each launch file will need to be modified to include zeroconf. The upside is that it is simple and free of unintended consequences.

   1 roslaunch zeroconf zeroconf.launch


Avahi supports system-wide service configuration files. This will announce the availability of the ROS Master service without running a separate node. The downside of this approach is that the service will be announced to the local network regardless of that state of rosmaster.

   1 cp `rospack find zeroconf`/config/ros-master.service /etc/avahi/services/.

The provided launch file can be modified so that the zeroconf node only provide discovery of network resources without announcing the availability of the master.

Patching roscore

Another approach is to add zeroconf directly to roscore startup via this patch. This has the advantage that the services will only be announce when rosmaster is running, and that individual launch files do not need to be modified. The downside is that it modifies roslaunch and that might be bad.

Think before patching...

   1 more `rospack find zeroconf`/config/roscore.xml.patch
   2 patch `rospack find roslaunch`/roscore.xml < `rospack find zeroconf`/config/roscore.xml.patch

Service Example

The following command will call the discover_masters service and return a list of Masters and its associated MASTER_URI.

   1 rosservice call /zeroconf/discover_masters

$ rosservice call /zeroconf/discover_masters
    master_name: Winston X. Robot
    master_uri: http://foo.local:11311
    master_name: Rob D. Robot
    master_uri: http://bar.local:11311



Publishes service announcements of ROS Master URI via Zeroconf using Avahi, This node also provices a client server interface for polling a list of currently known ROS Masters found on the local network


discover_masters (zeroconf/DiscoverMasters)
  • Discover a list of ROS Master URIs on the local network


~publish_master (bool, default: true)
  • Publish the availability of the ROS Master
~master_name (string, default: "Unknown")
  • This will often be the name of the robot if ROS is configure so that each robot runs ROS Master locally. It should be unique within the context of the local network, if it is not unique the name will be changed to something like "Unknown #3".
~service_type (string, default: "_ros-master._tcp")
  • This may or may not need to be changed for UDP
~master_host (string, default: socket.gethostname())
  • The hostname defaults to whatever python thinks your hostname is, if this value is wrong it may cause timeout error during service resolution.
~master_domain (string, default: "local")
  • One of the best features of zeroconf is every machine on the lan can be contacted through the local domain. Zeroconf resolves the IP addresses automatically so that the machine foo can be pinged by running ping foo.local.
~master_port (int, default: 11311)
  • This is the port that the ROS Master listens on.

Newly proposed, mistyped, or obsolete package. Could not find package "zeroconf" in rosdoc: /home/rosbot/docs/en/api/zeroconf/manifest.yaml

Known Bugs

  • Service types probably need some sort of official approval
  • Patches need to be sent to Avahi maintainers
  • ROS Launch URIs are not currently announced, is this useful?

Wiki: zeroconf_python_avahi (last edited 2013-06-26 06:16:09 by DanielStonier)