Algorithm 2
The behavior that the window cleaning robot should perform when using algorithm 2 can be divided
in the following rough steps:
- The robot is placed at a random position on the window.
- The robot moves to the upper edge of the window.
- The robot cleans the upper row of the window like in the default algorithm and moves to the second row.
- The robot cleans this row once but keeps track of where any dirty spots are left.
- It will turn at the end of the row, go back over all the dirty spots in the middle of the row, turn again and repeat this motion until all the dirty spots in the middle of the row are gone.
- The robot cleans the entire row once again in order to get rid of any stripes, and continues to the next row.
- The 3 steps above will be repeated until the robot reaches the bottom row, which will be cleaned like the top row.
The main advantage of this algorithm above the default algorithm is that, like algorithm 1, the robot can skip most of the already clean spots on the window when cleaning harder to
clean dirty spots. However, unlike algorithm 1 the reciprocating motion goes over as many dirty
spots as possible at once. This may be advantageous when there are large, harder to clean dirty
spots in the middle of the window since the robot does not have to continuously move backward
in order to check with its dirt sensors whether or not the dirty spot is cleaned. The dirt sensors
will automatically move over the just cleaned spots since the robot turns at the end of the still to
be cleaned part of the row. This means that this motion planning algorithm will be a more efficient
cleaning tactic for the above-mentioned dirt distribution.