What is the physics of tilt compensation of an electronic compass This question concerns the physics behind the implementation of electronic compasses to find the orientation of a device.
In the robotics community, 3-axis magnetometers are often used for this purpose. After some calibration, these provide a three-dimensional vector indicating the direction of the earth's magnetic field relative to the sensor.
As a second step, apparently a process called "tilt" detection is carried out. This uses a 3-axis accelerometer to measure the vector of earths gravitational field relative to the sensor and use it to determine roll and pitch of the device.
The roll and pitch angles are then used to somehow "compensate" the magnetic measurement for the tilt of the device.
What is the purpose of this tilt compensation? Why is it needed? Could it not be made obsolete by combining the position data from a gps with earth magnetic maps?
Am I understanding correctly when concluding that at the equator no tilt correction is necessary while close to the poles the errors are large without tilt correction?
I am not looking for implementation details but a easy to understand physics reasoning of what the problems are that are being solved by the "tilt compensation" and what alternative solutions are to measuring the earthy gravity field.
 A: This particular orientation sensing protocol is not wonted to me, but the following, given the data you cite, will indeed give you your orientation in space:


*

*Magnetometer gives $\vec{N}_0$ north direction (in general, not parallel to the "ground" because it has magnetic dip included);

*Gravity accelerometer gives $\vec{D}$ "down" direction;

*Then $\vec{D}\times \vec{N}_0 = \vec{E}$ east direction, parallel to the "ground" and lastly:

*$\vec{E}\times \vec{D}=\vec{N}$ gives north parallel to the ground (with magnetic dip culled out). 


You now have your full orientation in space: $\vec{D},\,\vec{N},\,\vec{E}$.
By "ground" I mean a spherical surface of constant altitude above sea level, or constant distance from the Earth's centre.
GPS calculates position, which means it can only calculate orientation by comparing positions of several sensors on a body, sited at least 10m apart and even then orientation would not be very accurate. Indeed, some knowledge of position will be needed to take magnetic declination into account. By processing GPS data, an object can calculate its orientation as it moves only if it can be sure its orientation does not change appreciably between measurements (this is how a car GPS works out your heading), but it must move a considerable distance (tens of metres) to do this. 
GPS + earth magnetic maps cannot replace the magnetometer. Sure, these data will tell you which way the local magnetic field points, but you still need to sense this direction to know which direction this is. Also note that many systems (e.g. life critical ones) are required to be independent of GPS and potentially unreliable GPS reception.
A: 
If I understand your question correctly this correction is necessary if you need to find the direction of the geographic north (or south), which is usually different from the magnetic north. There is a tilt of approximately $11^O$ between the two. As of 2010, the magnetic north was located at approximately 80.08°N 72.21°W, on Ellesmere Island. One way to find the direction of the geographic north on the surface of the Earth is if you know the direction of the magnetic field and if you know the direction of the center of the Earth, which you can find with the accelerometers, and if you know the geographical position of the magnetic north (this is important). I would imagine that the measurements of $\vec{B}$ and $\vec{g}$ would have to be very precise to get a good correction. If you had your (lat, lon) location from GPS this could substitute the need for the accelerometers, that's correct. But you would still need $\vec{B}$ and the geographical position of the magnetic north.
To answer your questions, as you go to higher latitudes this correction can become more important, depending on the longitude. But even at the equator, depending again on the longitude, your corrections could be significant, since the magnetic north has a westward component. 
