Tuesday, June 2, 2009

Edge Detection

After some testing of the lightsensor on the mars landscape, we discovered that the light deviation on the landscape was between 1 and 6 light values. The light deviation between the landscape and the edges is approximately 12, the deviation between the landscape and the lakes 10 and between the landscape and the middle of the landscape 5. This last small deviation makes it difficult to detect.

Software
To be protected against not detecting the edges, or detecting several light deviations on the landscape as edge, some software tricks have to be implemented. To be protected, it is chosen to take the mean of the last 50 light values as the light value to be compared to. Using the mean of a array of samples, and updating this array continuously, smooth light changes in the landscape won’t be detected as an edge. The largest advantage of adapting to the surface is that the changes in light when detected an edge will be larger than the changes on the surface. An example is given in the figure below.

Function usage
The edge detection is the main part running on the slave brick. The slave brick is continuously running the edge detection with the communication to send the light value as quick as possible to the master. To send a small as possible code, the light sensors have a value assigned. In this case, the left sensor has value 1, the middle sensor value 2 and the right value 4. Now, all values between 0 (none) and 7 (all) have assigned which sensors are triggered.