can anyone suggest a way of keeping position

im building a robot that uses an old PS2 optical mouse as a tachometer, problem is that no mater which way the robot is going it thinks that he,s going in a staight line. Can anyone suggest a way to make him see the difference between directions, sth like a compas or sth.

im usining two hacked SERVO motors so i cant exactly tell how many degrees it turns each time.

sorry for bad English;)

A compass or a gyro or both. A compass sensor is called a magnetometer.

This would be a simple solution :
This is the top solution :