The objective of our third and final lego project was to program our robot
in such a way that it is able to read instructions from the surfaces it crashes on and perform these tasks. In other words, every time it hits a solid object head on it will react taking into account whatever signs we want to read from the object. Our first decision had to do with what surfaces to read. Since for our previous project we had already used
an infra red sensor to read the walls, the decision was taken to continue using this sensor.
Another decision that had to be taken was the kind of objects that we would use to read the instructions off of. We tried several things, paper cubes, cardboard cutouts and several other things that did not quite work the way we needed them to. We finally settled on using wooden cubes, these were heavy enough to hold their ground when bumped into and big enough (4" x 4") to take readings from. Now the problem was that we had to find something to put on the cubes, that the robot would read. We decided to paint the cubes. Since the readings from our sensors are influenced a lot by even the slightest change in lighting, we needed a big range in between the colors, this is the reason why we chose to stay with our old friends black and white. This uncovered another problem, we only had two tasks for the robot to perform, one task for white and another for black. Since two tasks would make for a rather boring project, we discussed different ways to increase the number of instructions.
The best solution turned out to be an extra infrared sensor. The sensor was placed about 2" above the front-center bumper. This in fact provided us with two sensors at the front of the robot, and allowed us to paint the cubes using different patterns of black and white. When the robot hits something head on a reading from both infrared sensors will be taken and depending on these will be the task to be performed.
When it came time to assign tasks to the different readings we found out that we had already programmed two of the patterns for project two. A reading of black at the bottom and black on top would result in a right turn, and a reading of two whites would result in a left turn. We only had to worry about two extra commands, black bottom/white top which would result in the robot stopping, and white bottom/black top which would make the robot turn 180 degrees.
Since we had already used the infrared sensor to read walls, most of our previous program came in useful. We only had to dispose of the parts we did not need while incorporating the readings from the new sensor. When all the programming was done and the cubes were painted, we were able to basically program our robot to go to any predetermined point by just using the cubes and the walls in the arena.