I wanted to enable my robot with a sense of distance. Luckily my robot has build in distance markers in its tank treads. There are little gaps in the treads which I can put infrared emitters and detectors on either side of. This will allow my arduino to count the number of gaps that have passed by while the robot is moving.
The number of gaps is a constant and so I will be able to count the number of revolutions of the track and measure the distance that the robot has traveled. Furthermore, by putting a gap counter (an emitter and a detector) on both the right and left tracks I will be able to calculate the angle that the robot has turned when it does so.