In UAVs the sensors responsible for the compass function are the magnetometer and the gyroscope.
Then, it is extremely recommended to calibrate the vehicle magnetometers before any outdoor flight (the AR.Drone has a factory-built function to do that).