Monday, June 1, 2009

The path executer

During one of the brainstorm sessions of our group, the idea of using predefined paths became an interesting functionality. The goal of this path executer is to be able to reconstruct the travelled distance and path quite easy. Software

The path executer is a function that uses predefined paths that are implemented in the code. The five paths that are defined are shown in the figure below. All these paths can be travelled in forward direction, but also in reverse direction. When, for example, an edge is detected, the position in the array is stored. Knowing where the path executer has stopped, it is easy to travel back the part of the array that had been travelled. When the path executer has travelled the given array, it gives when it is finished or not. To detect edges, after executing a step of the array, the value of the edge detection is checked before executing the rest of the array. To prevent the rover from driving off the edge, each of the values in the array should not be too large.

Function usage

Within the rest of the written code, a path can be executed by giving the kind of array that has to be driven and the direction. When an edge is detected, also the last executed part of the array can be given, which executes the path in reverse order to get back to the original position. A graphical overview of the code is given below.