Week 3 - Section 5 - Robots communications

In the first week we will learn about the edison robot, its capabilities, sensors and communication with the software. We will also learn how to use the EdWare, the software for programming edison robots.

Chapter 10.1 - Bounce without borders

A robot swarm a number of robots that work together to solve a common problem. Generally the robots are small and by themselves aren’t very intelligent, but as a swarm they can achieve complex tasks (think of ants building a complex nest). The most important part of swarm robotics is communication. Without robot to robot communication a robot swarm is impossible. Here is an introduction to robot communication.
In this exercise you will need at least two Edison robots. The first Edison will bounce within a border and tell the second robot each time a border is encountered. The second robot will use this information to mimic the first robot and will seem to bounce in side an invisible border.
Write the following program for the first Edison (Edison with borders).

Create an 8 bit variable called ‘Black_Line’ and set the initial value to 1.

How the first program works
The first icon turns on the line tracking sensor LED. The program then enters an endless loop. The IF icon in the loop checks the state of the line tracking sensor, if the surface is white (reflective) then the dual drive icon drives Edison forward at speed 4. If the surface is black (non-reflective) then the contents of the variable ‘Black_Line’ (1) is transmitted. Edison then reverse-turns for 0.25 seconds and repeats the loop.
Write the following program for the second Edison (Edison without borders).

Create an 8 bit variable called ‘Black_Line’ and set the initial value to 0.
You can program a third, fourth or fifth Edison with this program for more fun.

How the second program works
The program goes straight into an endless loop and reads incoming data using the receive data icon. The receive data icon places the data into the variable ‘Black_Line’. The IF icon then checks if the data in the variable is equal to 1. If it isn’t (no data from the other Edison) then the dual drive icon drives Edison forward at speed 4. If the data does equal 1 (the other Edison has encountered a line) then the dual drive icon drives Edison in a reverse-turn for 0.25 seconds. The loop is then repeated.

What to do
Use the track and place the first Edison inside the border. Place the second Edison outside the border and press the play button on both Edisons.
The Edison inside the border will not leave the oval and the second Edison will mimic the firsts every move.

This is just an introduction to robot communications. Can you improve on this program and can you achieve two way communications? What if the first Edison couldn’t turn until the second Edison confirmed that it had received data?