Exercises — IMU — integrated accelerometer + gyroscope
Before we start, one shared reminder of the two objects we lean on all page:
Throughout we take and, unless said otherwise, gravity points down: .
Level 1 — Recognition
L1.1 — Name the sensor output
Two sensors sit inside an IMU. Sensor A outputs a vector in ; sensor B outputs a vector in . Name each sensor, name the symbol for its output, and say in one phrase what it physically tells you.
Recall Solution
- Sensor A () is the gyroscope, output . It tells you the angular rate — how fast the box is turning about each body axis right now.
- Sensor B () is the accelerometer, output . It tells you the specific force — the spring push per unit mass, i.e. every force except gravity. The units are the giveaway: turning is measured in radians per second; a push per mass is measured in metres per second squared.
L1.2 — What does a resting IMU read?
A level, motionless IMU sits on a table. State (i) the gyro reading and (ii) the accelerometer reading as a vector, with .
Recall Solution
(i) Gyro: — nothing is turning. (ii) Accel: true acceleration (it's not moving), so It reads pointing up. The only spring force is the table's normal push, and that push points up. Magnitude .
Level 2 — Application
L2.1 — Free fall
An IMU is dropped and falls freely (no air resistance). What does the accelerometer read? What does the gyro read if it isn't spinning?
Recall Solution
In free fall the only force is gravity, so . Then The accelerometer reads zero — no spring is stretched because the proof mass falls alongside the case. The gyro reads since it isn't turning. (This zero- reading is exactly what a "free-fall detected" feature in phones triggers on.)
L2.2 — Skew-symmetric matrix
A gyro reads . Write the skew matrix and use it to compute for .
Recall Solution
The pattern (from the parent note) with : Multiply by — that just picks the first column: Cross-check with the definition . ✓ The skew matrix is just "cross product, packaged as a matrix."
L2.3 — Tilt angle from a still accelerometer
A stationary IMU is tilted so its accelerometer reads . About which axis is it tilted, and by what angle? Then say what you would do if instead .

Recall Solution
The reading has no -component, so the box is tilted about the -axis. For a still sensor pitched by angle about , the body-frame gravity reaction is . Look at s02: is the leg of the tilt triangle across from ("opposite"), the leg beside it ("adjacent"). Why arctan? turns an angle into the opposite/adjacent ratio; runs it backwards — "which angle has this ratio?" Check: ✓, ✓. Why plain is not enough — the quadrant problem. only ever returns an answer in , because repeats every : . So the ratio alone cannot tell a tilt from a tilt (box flipped upside-down). For the second reading the ratio is still , yet both and — the box is pitched into the third quadrant. The fix is the two-argument , which looks at the signs of both components: So use always; plain is only safe when you already know (box roughly upright).
Level 3 — Analysis
L3.1 — Rotate a still, tilted reading back to world
A truly still IMU is pitched about . Because it is still, its body reading is the gravity reaction expressed in body coordinates, i.e. . With (see the frame definition above), compute , then rotate to world , then . Confirm the box is truly still ().
Recall Solution
Step 1 — the correct body reading. A still sensor senses the world-up gravity reaction expressed in its own tilted axes. "World-to-body" is the transpose : Hold on — check the sign against the picture (s01). The gravity reaction points along world +z; in a box pitched forward by its body -leg is . Using the standard above, 's top-right entry is , giving . The sign of just encodes which way the pitch leans; its magnitude is and , exactly the numbers from L2.3. Take , i.e. a pitch of the opposite sense, so the arithmetic lines up with L2.3. Step 2 — rotate back to world. Apply . Substitute symbolically (decimals invite rounding traps): So the naive rotation of this particular gives and — not zero! The box would look like it is accelerating sideways. Step 3 — find and fix the inconsistency. The trap is a frame mismatch: is the world-to-body image using with the opposite sign convention than the we then applied. Do it consistently: with the standard , the true still reading is . Rotate that back: Hence and Lesson (the whole point): and must be used as a matched pair — "world-from-body" out, "body-from-world" in. The moment you rotate a body vector with a transpose that doesn't match, a still box appears to accelerate by . Get the pairing right and exactly, as it must for something that isn't moving.
L3.2 — Gyro bias → angle error
A gyro has a constant bias . How large is the heading error after , in degrees?
Recall Solution
A constant bias integrates linearly: . Why linear? A bias is a constant rate of false rotation; the integral of a constant is a straight line in time. No signal fights it, so it just accumulates.
L3.3 — The position drift
Convert to and find the tilt-leaked position error after using .
Recall Solution
Convert: . Compute the pieces: ; then ; times ; divide by 6 . Why so brutal? As the growth curve in s03 shows, the gyro bias tilts the frame (), leaking a gravity component as a ramp acceleration error (); integrate a ramp twice and you get . Doubling the time multiplies error by .
Level 4 — Synthesis
L4.1 — One strapdown step by hand
An IMU starts level () at rest (, ). Over one step the gyro reads (pure yaw) and the accelerometer reads (a level, still box). Using the first-order updates compute , , , .
Recall Solution
Orientation. for is This is a tiny yaw of about — exactly one step of turning. Acceleration. With : . The still, level box has zero true acceleration — good. Velocity / position. ; . Net: the box rotated slightly but did not move — precisely correct for a spinning-in-place, level IMU. Gravity cancellation worked because orientation was known before we removed .
L4.2 — When gravity leaks in
Repeat L4.1 but the box has already drifted to a tilt — using the world-from-body pitch operator defined at the top of the page — while still physically at rest, so it truly reads . What horizontal does the strapdown compute if — by mistake — the algorithm still believes ?
Recall Solution
The true body reading (world-to-body via the transpose, matched pair as in L3.1) has magnitude split across / along: If the algorithm wrongly uses (it does no rotation): A phantom horizontal acceleration of magnitude appears! Its size is exactly : the un-removed gravity component along the tilted axis. This is the mechanism behind the drift — a small attitude error injects a real-looking horizontal push.
Level 5 — Mastery
L5.1 — Design a fusion budget
A drone needs horizontal position accuracy of . Its GPS drops out and only the IMU runs. The IMU's gyro bias contributes with (a good MEMS gyro). For how long can it coast before position error hits ? What does this tell you about GPS update rate?
Recall Solution
Set and solve for : So this gyro alone stays within for about 27 seconds. What this tells you about GPS update rate. The IMU's error escapes the box in ~27 s, so an external fix must arrive well before then — you never wait until the last second, because near s the error is climbing steeply (cubic). A sensible rule is to correct with comfortable margin, e.g. every few seconds (say – s), so the estimate is repeatedly pulled back long before it approaches . Concretely: pick the GPS/vision update period so that the worst-case IMU-only drift between fixes stays a small fraction of the budget. If GPS only updated at ( s period) that is plenty; if it could only update every s, this gyro would already blow the budget between fixes and you would need a better gyro or a faster aiding sensor. The design coupling is: update period safety margin drift-out time. This is precisely the job of Sensor Fusion & Kalman Filter; during brief outages (GPS-Denied Navigation) the IMU carries you, over minutes it cannot.
L5.2 — Why fuse a gyro with an accelerometer for tilt?
The accelerometer alone can estimate tilt from the gravity direction (L2.3). The gyro alone can estimate tilt by integrating rate. Explain, in terms of error growth vs noise, why a complementary/Kalman fusion of the two beats either alone.
Recall Solution
- Accelerometer tilt estimate: correct on average (gravity is a fixed reference), but any real acceleration or vibration corrupts a single reading — it is noisy but drift-free. Good at low frequency / long term.
- Gyro tilt estimate: smooth and immune to translational shake instant-to-instant, but its bias makes it drift as — clean short-term, wrong long-term. Good at high frequency / short term.
- Fusion takes the gyro for fast changes and gently pulls it back toward the accelerometer's gravity reference over time. The result inherits the gyro's smoothness and the accelerometer's zero long-term bias, cancelling each sensor's weakness. Formally this is the trust-weighting a Kalman filter performs; conceptually it's why Sensor Fusion & Kalman Filter, Dead Reckoning, and Reference Frames — Body vs World all appear together in any real navigation stack.
Recall One-line takeaways
Rotate before you subtract gravity ::: A tilt error of angle leaks as fake horizontal acceleration. Why position drift is cubic in gyro bias ::: Bias tilts frame () → ramp accel error () → integrate twice → . Why fuse gyro + accel for tilt ::: Gyro is smooth but drifts; accel is drift-free but noisy; fusion keeps the best of both. What atan2 fixes that arctan cannot ::: arctan only spans ; atan2 reads both component signs to place the angle in the correct quadrant.