I am using a compass sensor (LSM303DLM 3D Compass and Accelerometer Carrier with Voltage Regulators to be precise) to ensure that the robot runs along a straight line. I am interfacing it with Arduino Mega. I looked at the code on github (github.com/pololu/lsm303-arduino) and some of the previous posts on this forum but I don’t quite understand the readings output by LSM303DLM.
The readings from the magnetometer are in gauss. So if the robot deviates from its straight line path, the interference with earth’s magnetic field will change and thus change the readings, in that case how will I know on which side it went off track and which motor must be slowed down to bring it on track? (it is a dual motor drive robot and the compass is stationary with respect to the robot) Could someone please explain the output from the compass?