The goal is to construct a bridge of communication sensors. At the two ends of the room will be two ports, connected to PCs, which try to establish a communication by emitting RR packets periodically. The two ports will be associated with addresses 0 and 1. They run a normal protocol, so once the connection is established, they can do the RR-RP-RC sequence and start the flow of packets.
The protocol to be run at the robots roaming around in the room is as follows.
- The robots listen, and propagage, the RR packets, as usual.
- The robots check the source of each packet they receive. Whenever they receive a packet (RR, RP, RC, DT, AK - any of them) from source k, where k is one of 0, 1, they "color" themselves of color k. The color is removed after 20 seconds since the last packet from source k (make the 20 a #define, of course, so we can fine-tune this).
- When the robots are not colored, or colored with only one of the 0, 1 colors, they move at random. Of course, they have to avoid collisions (back up as usual) during this phase.
- When the robots are colored with both 0,1 colors, they stop moving, so that a communication bridge has a chance of getting established.
Thus, the protocol at the robots can be implemented as the sum of three pieces:
- The normal packet propagation and routing code.
- Code that examines the source of packets, sets the colors, and uses timers to remove colors after time-outs.
- Code that makes the robot roam around at random, backing off when it hits an obstacle.
