A magnetic compass like the one created on the previous page has several problems when used on moving platforms like ships and airplanes. It must be level, and it tends to correct itself rather slowly when the platform turns. Because of this tendency, most ships and airplanes use gyroscopic compasses instead.
A spinning gyroscope, if supported in a gimbaled frame and spun up, will maintain the direction it is pointing toward even if the frame moves or rotates. In a gyrocompass, this tendency is used to emulate a magnetic compass. At the start of the trip, the axis of the gyrocompass is pointed toward north using a magnetic compass as a reference. A motor inside the gyrocompass keeps the gyroscope spinning, so the gyrocompass will continue pointing toward north and will adjust itself swiftly and accurately even if the boat is in rough seas or the plane hits turbulence. Periodically, the gyrocompass is checked against the magnetic compass to correct any error it might pick up.
For more information on compasses, navigation and related topics, check out the links below.