The Robotic Car Mark 2 project started with complications that I ran into with my first robotic car project. The basic problem is that in order to make the car able to self-navigate it had to be able to determine how many degrees the car turned. Without this ability, the car could not make 90 degree turns or turns of other angles reliably.
The first car lacked the ability to control the distance that each wheel turned. This could be accomplished with software if each wheel was calibrated with its speed value [0-255] with the time to go a measured distance. With these measurements for each wheel at each speed setting, time could be used to determine the amount that the car turns. This assumes two things. First, the wheels do not slip. Second, real time can be measured accurately.
Calibrating each wheel at each speed value was something that I did not want to do. It was too tedious. Plus, there is no guarantee that the wheels do not slip during a turn, thus making the calibration measurements useless. The other factor is that you cannot measure time accurately in Linux when the version of Linux is not a Real-Time version.
The solution that will be incorporated in the Mark 2 version will be to use a compass module. The angle the car is headed before the turn and the desired change in angle can be used to determine when a turn is complete. This method will work regardless of whether the wheels are calibrated or whether the wheels slip.
In addition to a compass, the Mark 2 car will also include encoders on each motor/wheel. These will generate interrupts and the specific number of interrupts matches one rotation of the wheel. That specific number is determined by the number of slots on the encoder disk attached to each motor.