Guidance, Navigation and Control · Theory · M6
M6-T5 — Initial Alignment: Levelling and Gyrocompassing
Before the first flight the computer must know which way the vehicle faces. At rest it can find out from gravity and from the rotation of the Earth, and the second is much harder than the first.
An inertial system starts with the attitude unknown. Roll and pitch are easy: at rest the accelerometers read the reaction to gravity, which points up. Heading is hard: it has to come from the Earth's rotation, a rate of 15°/h that a gyro must measure to better than its own bias. This lesson derives levelling and gyrocompassing, computes the heading error that a gyro bias and noise cause, and shows that on Hopper's pad a tactical gyro is just good enough and a consumer gyro cannot do it at all.
Learning objectives
After this lesson, you should be able to:
- Compute roll and pitch from the accelerometer outputs at rest and state their error from an accelerometer bias.
- Compute heading from the horizontal Earth rate measured by the gyros.
- Derive the heading error caused by an east gyro bias, by noise and by a levelling error.
- Decide which sensor grades can gyrocompass and how long they must average.
The intuition
UAV M2-T7: Inertial Navigation Systems lists alignment as a step of starting an INS. This lesson shows how it works and what limits it. A multirotor avoids the problem by taking heading from a magnetometer, which the aiding lesson of module 7 treats. A system that must know its heading without help from outside uses the Earth.
Roll and pitch from gravity
At rest the only specific force is the reaction to gravity, 1 g upward. In the body axes it is a vector whose components tell how the body is tilted: the lateral component gives roll, the axial one pitch. The method is a two-line formula, it is accurate to the accelerometer bias divided by g (0.1 mg is 0.0057°), and it needs only a few seconds of averaging. Nothing about it depends on where on the Earth the vehicle is.
Heading from the Earth's rotation
Once the vehicle is level, the gyros measure the Earth's rotation, 15.04°/h, which points north and up. The horizontal part, (11.5°/h at 40° latitude), points to the north. The gyro axes then show where north is: in a level frame the east gyro reads zero and the north gyro reads the full horizontal rate, and heading is the angle whose tangent is the ratio of the two body-axis readings. This is gyrocompassing. It works only if the gyros can resolve a rate of 11.5°/h to a small fraction of itself.
What limits it
An east gyro bias is indistinguishable from a small component of Earth rate along east, which is what a heading error would produce, so . A tactical gyro (0.3°/h) gives 1.5°, a navigation gyro (0.01°/h) 0.05°, an industrial one (3°/h) 15°, and a consumer one (20°/h) has a bias larger than the signal, so the gyrocompass gives nothing. The white noise sets a second limit that averaging reduces as the square root of time: the tactical angle random walk gives 0.5° after 5 minutes. A levelling error also leaks in, scaled by the tangent of the latitude.
Roll and pitch come from gravity and are easy. Heading comes from the Earth rate and needs a gyro bias that is small against 11.5°/h. Gyrocompassing is therefore a navigation-grade or good tactical-grade capability, and every other system takes its heading from outside.
Definitions
- Levelling
- Finding roll and pitch at rest from the direction of the specific force (the reaction to gravity).
- Gyrocompassing
- Finding heading at rest from the direction of the Earth rate in the level body axes.
- Horizontal Earth rate
- : the north component, 11.52°/h at latitude 40°.
- Coarse and fine alignment
- A fast first estimate (seconds) from the formulas, refined over minutes by a filter that also estimates the gyro biases.
Derivation: the heading error terms
Levelling, then the three terms of the heading error.
At rest the accelerometer reads the reaction to gravity, which is minus gravity (NED, down positive).
Write the third column of the direction cosine matrix for a 3-2-1 sequence; the components depend on roll and pitch only, not on the heading.
An accelerometer bias on the axial axis is indistinguishable from a tilt of that size. For 0.1 mg it is 1.0×10⁻⁴ rad, 0.0057°.
Heading
The Earth rate in the local frame (north, east, down). The east component is zero by definition of the frame.
Rotate the horizontal part through the heading into the level body axes.
Invert. The vertical component of the Earth rate is not used.
A bias on the east gyro adds to an amount that the formula reads as a change of heading of that size divided by the horizontal rate (its arcsine for large ones).
Averaging the gyro output for T seconds reduces white noise (angle random walk N) to ; divide by the horizontal rate to get an angle.
A tilt error about the north axis rotates the vertical Earth rate into the east gyro, a spurious ; divided by this is .
Gravity gives the level directly, and the accelerometer bias over g is the tilt error. Heading is the ratio of two components of a 15°/h signal, so every gyro error is divided by 11.5°/h: a bias of 0.3°/h costs 1.5°, and an error that is not small against the signal makes the method useless.
A worked example
Hopper on its pad at latitude 40°: roll 0.8°, pitch −0.5°, heading 30°.
- Levelling. From noise-free accelerometers the formulas return roll 0.8000° and pitch −0.5000°. A 0.1 mg accelerometer bias in the forward axis gives a pitch error of 0.0057°.
- Gyrocompassing. From noise-free gyros the heading is recovered exactly, 30.0000°.
- Bias. An east-axis gyro bias gives a heading error of 0.050° (navigation grade, 0.01°/h), 1.49° (tactical, 0.3°/h) and 15.1° (industrial, 3°/h). A consumer gyro with 20°/h exceeds the 11.5°/h horizontal Earth rate and no heading results.
- Levelling leak. A 0.5 mg forward accelerometer bias tilts the levelling by 0.0286° and moves the heading by 0.0120°, equal to the tilt component about north (tilt × sin 30°) times tan 40°.
- Noise. With an angle random walk of 0.01°/√s the scatter of the heading is 20.0° after 120 s of averaging (the formula gives 16.3°) and 7.35° after 600 s (formula 7.31°). For the data-sheet classes, after 300 s the angle random walk alone gives 5.2° (consumer), 1.7° (industrial), 0.52° (tactical) and 0.034° (navigation).
- Reading. A tactical gyro, 0.3°/h with 0.03°/√h, gives about 1.5° bias error and 0.5° noise: adequate for a launch, not for navigation over hours. Hopper's 3 m, 99% landing requirement over a 100 m hop does not need a heading better than a few degrees.
import math
def lcg(seed):
s = seed
while True:
s = (1103515245 * s + 12345) % 2147483648
yield (s / 2147483648.0 - 0.5) * 3.4641016
D2R = math.pi / 180
G0, Om = 9.81, 7.2921150e-5
lat = 40 * D2R
rnd = lcg(7)
# true attitude of Hopper on the pad: roll 0.8 deg, pitch -0.5 deg, heading 30 deg (NED, body forward-right-down)
phi, theta, psi = 0.8 * D2R, -0.5 * D2R, 30 * D2R
R_bn = g_bn = None
cph, sph, cth, sth, cps, sps = math.cos(phi), math.sin(phi), math.cos(theta), math.sin(theta), math.cos(psi), math.sin(psi)
# body from NED, 3-2-1
Rbn = [[cth * cps, cth * sps, -sth],
[sph * sth * cps - cph * sps, sph * sth * sps + cph * cps, sph * cth],
[cph * sth * cps + sph * sps, cph * sth * sps - sph * cps, cph * cth]]
def mv(M, v): return [sum(M[i][j] * v[j] for j in range(3)) for i in range(3)]
f_n = [0.0, 0.0, -G0] # at rest the accelerometers sense -g (the pad pushes up): NED z is down
w_n = [Om * math.cos(lat), 0.0, -Om * math.sin(lat)]
f_b = mv(Rbn, f_n); w_b = mv(Rbn, w_n)
def levelling(f):
r = math.atan2(-f[1], -f[2])
p = math.atan2(f[0], math.sqrt(f[1] ** 2 + f[2] ** 2))
return r, p
r, p = levelling(f_b)
print(f'levelling from noise-free accelerometers: roll {r / D2R:.4f} deg, pitch {p / D2R:.4f} deg (true 0.8, -0.5)')
def gyrocompass(f, w):
r, p = levelling(f)
cr, sr, cp, sp = math.cos(r), math.sin(r), math.cos(p), math.sin(p)
# rotate the measured rate into the level frame
wx = cp * w[0] + sr * sp * w[1] + cr * sp * w[2]
wy = cr * w[1] - sr * w[2]
return math.atan2(-wy, wx)
print(f'gyrocompassing from noise-free gyros: heading {gyrocompass(f_b, w_b) / D2R:.4f} deg (true 30)')
# accelerometer bias -> tilt error, east gyro bias -> heading error
ab = 0.1e-3 * G0
print(f'accelerometer bias 0.1 mg in the forward axis -> pitch error {ab / G0 / D2R:.4f} deg')
for name, eps in (('consumer 20 deg/h', 20.0), ('industrial 3 deg/h', 3.0), ('tactical 0.3 deg/h', 0.3), ('navigation 0.01 deg/h', 0.01)):
ratio = eps / (Om / D2R * 3600 * math.cos(lat)) # an east-axis bias over the horizontal Earth rate
if ratio >= 1:
print(f' gyro bias {name:22s}: the bias exceeds the horizontal Earth rate, no gyrocompassing')
else:
print(f' gyro bias {name:22s}: heading error {math.degrees(math.asin(ratio)):7.3f} deg')
# a tilt about the north axis leaks the vertical Earth rate into the east gyro: heading error = tilt * tan(latitude)
fb_bad = [f_b[0] + 0.5e-3 * G0, f_b[1], f_b[2]] # a 0.5 mg forward accelerometer bias
dh = gyrocompass(fb_bad, w_b) - psi
print(f'a 0.5 mg forward accelerometer bias tilts the levelling by {levelling(fb_bad)[1] / D2R - p / D2R:.4f} deg and moves the gyrocompass heading by {dh / D2R:.4f} deg (the tilt component about the north axis, tilt x sin(heading), times tan(latitude): {(levelling(fb_bad)[1] - p) / D2R * math.sin(psi) * math.tan(lat):.4f})')
# noise: average the gyros for T seconds and read the heading; compare the scatter with the formula
N = 0.01 * D2R # rad / sqrt(s), the ARW of the Allan example (36 deg/rt-h)
dt = 0.1
def trial(T):
n = int(T / dt)
sw = [0.0, 0.0, 0.0]
for _ in range(n):
for i in range(3):
sw[i] += w_b[i] + N / math.sqrt(dt) * next(rnd)
w = [x / n for x in sw]
return gyrocompass(f_b, w) - psi
for T in (120.0, 600.0):
errs = [trial(T) for _ in range(150)]
sd = math.sqrt(sum(e * e for e in errs) / len(errs)) / D2R
th_ = N / math.sqrt(T) / (Om * math.cos(lat)) / D2R
print(f' noise only, averaging {T:5.0f} s: scatter of the heading {sd:7.3f} deg, formula N / (sqrt(T) Om cos lat) = {th_:7.3f} deg')
print('heading error from angle random walk alone after 300 s of averaging, by grade:')
for name, arw in (('consumer', 0.30), ('industrial', 0.10), ('tactical', 0.03), ('navigation', 0.002)):
n_ = arw / 60 * D2R # deg / rt-h -> rad / rt-s
print(f' {name:11s} ARW {arw:5.3f} deg/rt-h: {n_ / math.sqrt(300.0) / (Om * math.cos(lat)) / D2R:8.3f} deg')levelling from noise-free accelerometers: roll 0.8000 deg, pitch -0.5000 deg (true 0.8, -0.5) gyrocompassing from noise-free gyros: heading 30.0000 deg (true 30) accelerometer bias 0.1 mg in the forward axis -> pitch error 0.0057 deg gyro bias consumer 20 deg/h : the bias exceeds the horizontal Earth rate, no gyrocompassing gyro bias industrial 3 deg/h : heading error 15.092 deg gyro bias tactical 0.3 deg/h : heading error 1.492 deg gyro bias navigation 0.01 deg/h : heading error 0.050 deg a 0.5 mg forward accelerometer bias tilts the levelling by 0.0286 deg and moves the gyrocompass heading by 0.0120 deg (the tilt component about the north axis, tilt x sin(heading), times tan(latitude): 0.0120) noise only, averaging 120 s: scatter of the heading 19.962 deg, formula N / (sqrt(T) Om cos lat) = 16.342 deg noise only, averaging 600 s: scatter of the heading 7.350 deg, formula N / (sqrt(T) Om cos lat) = 7.308 deg heading error from angle random walk alone after 300 s of averaging, by grade: consumer ARW 0.300 deg/rt-h: 5.168 deg industrial ARW 0.100 deg/rt-h: 1.723 deg tactical ARW 0.030 deg/rt-h: 0.517 deg navigation ARW 0.002 deg/rt-h: 0.034 deg
In robotics
Alignment is a part of every start-up, and its time and accuracy are part of the vehicle's specification.
- Aircraft and missiles. Inertial systems on the ground run a few minutes of gyrocompassing (alignment), with the vehicle stationary. Alignment time rises with the demanded heading accuracy, as the formula above says.
- Alignment in motion. When the vehicle cannot be at rest (a ship, a missile from an aircraft) the filter of module 7 aligns from a velocity or position reference instead, and the heading becomes observable from the motion rather than from the Earth rate.
- Using a magnetometer. Small vehicles use a magnetometer for heading, which works with any gyro but needs calibration and a magnetically quiet site (see the aiding lesson of module 7).
- Estimating the gyro bias. A fine-alignment filter treats the east and north gyro biases as states and can estimate the one in the horizontal plane, within the limits of observability: the heading and the east bias are confounded at rest, which is why the formula cannot do better than the bias.
- High latitude. The horizontal Earth rate falls as cos φ, and at the poles it vanishes: gyrocompassing fails and the error is growing without limit.
The drift budget in the next lesson uses the alignment errors as starting values. The formulas here also set the heading error that feeds the lateral position channel of M6-T4: INS Error Dynamics and the Schuler Oscillation.
Common misconceptions
“Gyrocompassing works with any gyro, given long enough averaging.”
Averaging reduces noise but not bias. A gyro whose bias is comparable to the horizontal Earth rate cannot give heading however long the record: a consumer gyro with 20°/h cannot gyrocompass at all.
“Heading is found from the accelerometers like roll and pitch.”
Gravity is vertical, and rotating the vehicle about the vertical does not change what the accelerometers read. Heading needs a horizontal reference, the Earth rate or a magnetic field.
“An accelerometer error does not matter for heading.”
It tilts the levelling, and a tilt about the north axis leaks the vertical Earth rate into the east gyro, giving a heading error of the tilt times tan φ. At high latitude this term is large.
“Alignment is a one-off and its error disappears.”
The initial attitude error starts a Schuler oscillation in the position error, with an amplitude proportional to it, and a heading error never decays at all. It stays in the navigation solution until an aiding measurement corrects it.
“At the pole the gyrocompass is most accurate.”
It is least accurate. The horizontal Earth rate is the signal, and it is largest at the equator and zero at the pole.
Key takeaways
- At rest the accelerometers read the reaction to gravity, which gives roll and pitch to about the accelerometer bias over g.
- Heading comes from the horizontal Earth rate (11.5°/h at 40°), measured by the level gyros.
- The heading error is the gyro bias divided by that rate: 0.05° (0.01°/h), 1.5° (0.3°/h), 15° (3°/h), and nothing for 20°/h.
- Noise averages down as ; bias does not.
- A tilt error about north adds times the tilt to the heading.
- Hopper's landing requirement needs only a few degrees of heading; a tactical gyro gives about 1.5°.
References and further reading
Each source is marked free or paid. Free to read does not mean free to reuse: the course resources page lists every source with its licence.
- P. D. Groves, Principles of GNSS, Inertial, and Multisensor Integrated Navigation Systems, 2nd edition, Artech House, 2013, chapter 5 on alignment. Paid.
- D. H. Titterton and J. L. Weston, Strapdown Inertial Navigation Technology, 2nd edition, IET, 2004, the chapter on alignment and calibration. Paid.
- A. Noureldin, T. B. Karamat and J. Georgy, Fundamentals of Inertial Navigation, Satellite-based Positioning and their Integration, Springer, 2013. Paid.
- MIT 16.07 Dynamics (OpenCourseWare) , for the kinematics of the rotating Earth. Free; licence CC BY-NC-SA 4.0.
Knowledge check
Three questions. Write an answer, then reveal the explanation. Your answers stay in your browser.
Question 1
A tactical gyro has a bias of 0.3°/h. What heading error does gyrocompassing at latitude 60° give, and how does it compare with latitude 40°?
Explanation
The horizontal Earth rate at 60° is 15.04 × cos 60° = 7.52°/h, so the heading error is asin(0.3/7.52) = 2.29°. At 40° the rate is 11.52°/h and the error is 1.49°. The error rises toward the pole because the signal, the horizontal Earth rate, falls as cos φ while the bias is unchanged: at 60° the same gyro is about 1.5 times worse, and at 85° it would be useless.
Question 2
After 300 s of averaging a navigation-grade gyro with ARW 0.002°/√h gives a heading noise of 0.034°. Why is the same averaging for a consumer gyro, 5.2°, not an answer to the problem?
Explanation
The noise term is only one part. A consumer gyro has a bias of 20°/h, larger than the horizontal Earth rate of 11.5°/h, so the bias term of the error budget is unbounded: no heading can be extracted from a signal smaller than the offset. Averaging reduces noise as 1/√T but leaves the bias untouched, so the 5.2° figure applies to a gyro whose bias had already been removed, which it has not.
Question 3
A forward accelerometer bias of 0.5 mg tilts the levelling by 0.0286°. Why does that change the gyrocompass heading, and by how much for a vehicle heading 30° at latitude 40°?
Explanation
A tilt rotates the vertical Earth rate (Ω sin φ) into the horizontal gyros. The part of the tilt about the north axis puts a spurious rate Ω sin φ × tilt on the east gyro, which the formula reads as a heading error of tan φ × tilt_N. For heading 30° the north component of a tilt about the body right axis is sin 30° = 0.5, so the heading error is 0.0286° × 0.5 × tan 40° = 0.012°, as computed.
What’s next
Related content
Nothing below is required to finish this lesson.
- BeforeM6-T4: INS Error Dynamics and the Schuler Oscillation
Derive the error equations of one horizontal channel, obtain the 84-minute Schuler period, and show why the vertical channel is unstable without aiding.
Other courses on this site treat neighbouring topics from their own angle:
- UAV M2-T7: Inertial Navigation Systems
- UAV M2-T8: Dead reckoning and inertial drift
- UAV M3-T7: IMU noise and bias modelling
- UAV M3-T8: IMU preintegration
- UAV M1-T8: IMU, barometer, magnetometer and GNSS
- Probability M2-T4: Distributions of Real Sensor Noise
- Probability M5-T4: Identifying Noise Parameters from Data
- Linear Algebra M10-T6: Small-Angle Approximations
This course leaves the following to the pages that already teach them:
Get notified when the next lesson and new labs are released.
One email per new lesson or lab.