Hardware lab 09 · Inertial sensing

Motion sensors disagree. Fusion makes them useful.

Rotate and shake a virtual controller while watching its accelerometer, gyroscope, register bytes, three orientation estimates, calibration bias, and drift.

fast gyro integration × α + slow gravity correction × (1 − α) → stable roll and pitch · yaw remains gyro-only

Live six-axis bench

SAMPLE
0 · 0.00 s
|ACCEL|
1.034 g
|ANGULAR RATE|
0.0 °/s
ACCEL TRUST
90%
GESTURE
STEADY

Motion and sensor conditions

Hold a direction to command angular velocity. Release it and the controller stops, but an uncalibrated gyro estimate keeps drifting from electrical bias.

Injected gyroscope zero-rate bias

ROLL
PITCH
YAW

Keyboard: arrows control roll/pitch · Q/E control yaw.

Stabilization experiment

Use the fused estimate to hold roll and pitch within 3° of level. A shake temporarily makes gravity an unreliable reference.

EstimatorRollPitchYawR/P error
True pose0.0°0.0°0.0°reference
Accel only-0.6°-0.3°not observable0.6°
Gyro only-0.6°-0.3°0.0°0.6°
Complementary-0.6°-0.3°0.0°0.6° to level

Bias calibration

A still calibration averages 192 gyro samples and subtracts the measured zero-rate offset. Calibration is rejected if the controller is moving.

STATUSUNCALIBRATED
SAMPLES0
ACTUAL BIAS X/Y/Z1.15 · -0.72 · 0.86
ESTIMATED BIAS X/Y/Z0.00 · 0.00 · 0.00

Raw signal scope

Six channels before fusion

AxisRaw accelGravity modelRaw gyroBias-corrected
X0.0055 g0.0000 g1.034 °/s1.034 °/s
Y-0.0101 g0.0000 g-1.171 °/s-1.171 °/s
Z1.0341 g1.0000 g1.503 °/s1.503 °/s

Accelerometer axes: X right · Y forward · Z up. Gyro axes: X roll · Y pitch · Z yaw.

12-byte register burst

Signed 16-bit big-endian words: AX AY AZ GX GY GZ. This bench models ±8 g at 4096 LSB/g and ±2000 °/s at 16.4 LSB/(°/s).

00 17 FF D7 10 8C 00 11 FF ED 00 19
1 · MEMSMicroscopic proof masses and vibrating structures respond to acceleration and rotation.
2 · ADCSix analog channels become signed register words at the selected sample rate.
3 · CALIBRATIONStored offsets remove much of the zero-rate bias before integration.
4 · ESTIMATORSGravity gives absolute roll/pitch; gyro integration gives fast relative motion.
5 · FUSIONA complementary filter trades short-term response for long-term stability.

Experiments to try