Let’s describe a situation with which every seasoned roboticist is familiar with: You’re deploying your robot in a DHCP managed wireless network. Unless your robot is configured with a static IP address, you won`t know be able to know which dynamic IP address will be assigned by the DHCP server.
Since many robots expose a SSH server (and indeed wanting to know the robots IP address has much to do with wanting to establishi a SSH connection) one simple trick is to use nmap in order to locate SSH servers on the local network:
| |
However, there’s a drawback: when multiple robots are roaming within the same wireless network you’ll have to manually try every single listed IP. nmap can also list MAC addresses (-n), but this approach still necessitates a priori knowlegde of your robots MAC. Also, if you’re using an external wireless network interface the MAC will change when devices are replaced.
In this article I want to show a different solution implemented in the L4XZ autonomy stack: A discovery server on every robot is using UDP multicast messages to broadcast a unique id. Multicast messages enable one-to-many communication (as opposed to broadcast, which enable one-to-all) and are therefore well suited to transmit a discovery packet to interested listeners.

The discovery packet contains a 16-byte unique id and up to 64 byte (null-terminated) description string, which is sent periodically by the robot. (And no, sending a discovery packet containing a non-terminated description string will not cause a stack overflow.)
| |
A separate device in the same wireless network is subscribing to and displaying the content of received discovery packets. Connecting to the robot is then simply a matter of selecting the desired robot from a selection.

