12.2 Thin Airfoil Theory & Panel Methods left the light aircraft able to make lift: N from a NACA 2412 wing at about . But flying is mostly rotating, and a simulator must know where the nose points at every step. In 2-D an orientation is one angle. In 3-D the order of turns matters, the obvious three angles break down when the nose points straight up, and a spinning body can flip over by itself. This lesson builds a flight simulator’s attitude tools and the equations that move them.
Tools: 1.2 Matrices as Transformations, 1.4 Determinants as Volume Scaling, 1.6 Change of Basis & Diagonalization, 7.7 Nonlinear Systems & Linearization, 4.3 Runge–Kutta Methods & Butcher Tableaux, 4.7 Energy & Symplectic Integrators.
Transcript
- Last lesson left a light aircraft that makes lift: 12 633 newtons from a NACA 2412 wing. But flying is mostly rotating. The order of turns matters, the obvious three angles break down when the nose points straight up, and a spinning body can flip over by itself.
- A rotation matrix has the body axes as columns, in world coordinates: x north, y east, z down. Column one is the nose. Its transpose is its inverse, its determinant plus one. Now turn this aircraft. Roll ninety degrees, then yaw ninety: the nose swings east. Yaw first, then roll: the nose points down. Rotations do not commute.
- The aerospace angles are yaw, pitch and roll. Gyros measure body rates, and the angle rates come from a matrix whose determinant is cosine theta. Near vertical that vanishes: gimbal lock. With a body yaw rate of 0.1 radians per second, heading must change at 0.576 at pitch 80 degrees, 5.730 at 89, and 57.296 at 89.9. The aircraft barely moves; the coordinates race.
- So spend a fourth number. A turn by alpha about axis n is the quaternion cosine half alpha, n sine half alpha. Composition is multiplication: roll then yaw is a single 120 degree turn about the diagonal, one half, one, one, one. The kinematics are q dot equals one half q times zero omega: linear, with no division, on a sphere with no poles.
- Fly a loop at 0.5 radians per second with a small yaw, 0.001, integrating angles and quaternion by RK4. The Euler angles spike near the top, 200 radians per second, and end 7.3353 degrees off. The quaternion misses by 7.3 times 10 to the minus 8 degrees.
- A spinning body has angular momentum L equals I omega. The inertia tensor is symmetric, so its eigenvectors are perpendicular: the principal axes. Our light aircraft has eigenvalues 1521.8, 2462.0 and 3618.7 kilogram metres squared, and its roll axis tilts 2.94 degrees nose-down. The simulator's box is 5, 10 and 13 over 1200.
- Newton holds in the world, but I is constant only in the body. Differentiating a turning vector adds a term, giving Euler's equations. With no moment there are two invariants: the energy, and the length of L. An integrator should keep both: free error meters.
- Spin the box about its middle axis, one turn per second. That axis is a saddle: perturbations grow at lambda equals 3.0183 per second, e-folding every 0.3313 seconds. And the box flips. The spin rate first changes sign at 2.398 seconds, then every 4.0665. A perturbation ten times smaller delays the first flip by 0.763 seconds, natural log ten over lambda.
- Over twenty seconds, five flips, forward Euler's energy grows by thirty-nine percent. RK4 at 0.01 seconds drifts by minus 4.2 times 10 to the minus 9. The splitting method rotates exactly about each principal axis in turn: L exact to round-off, energy error 1.1 times 10 to the minus 7, oscillating, never growing.
- A thousand newton-metres turns the aircraft at 0.657 radians per second squared in roll, 0.406 in pitch, 0.276 in yaw: roll starts easiest. From memory: Explorer 1, 1958, spun about its minimum axis, lost energy, and tumbled end over end. And the Dzhanibekov effect: a wing nut flipping aboard Salyut 7, 1985.
- Rotation is now in hand. Next, 12.4: the six-degree-of-freedom model joins it to lift, in twelve states, advanced by one RK4 loop.
Rotation matrices
The world frame (aerospace convention) has north, east, down. The body frame is glued to the aircraft: out of the nose, out of the right wing, out of the belly. A vector with body components has world components
As in 1.2, the columns are where the basis vectors go: column 1 is the nose direction in world coordinates. Three facts follow.
- Orthogonal. Entry of is the dot product of columns and , perpendicular unit vectors, so and .
- Determinant . Rotations keep volume and handedness; a mirror has orthogonal columns but determinant .
- Not commutative. Roll about north (), then yaw about down (): the roll leaves the nose alone and the yaw swings it east, . Yaw first: the nose goes east, then the roll about north tips it down, . Plane rotations commute (1.2); these do not.
Euler angles and gimbal lock
The aerospace angles are yaw , pitch , roll , applied in that order (the 3-2-1 sequence): . The trouble is their kinematics. Rate gyros measure body rates ; each angle turns about a different axis ( about , about the once-rotated , about world ). Writing those axes in body components and adding,
a matrix with determinant . Inverting it:
At the determinant vanishes: with the nose vertical, the yaw axis and the roll axis coincide and one direction of the column space is lost (1.3 Linear Systems, Kernel & Column Space). That is gimbal lock. The aircraft is fine; the coordinates demand huge rates for ordinary motion. A pure body yaw rate rad/s at zero roll gives , (gimbal sim readout):
| pitch | (rad/s) | (rad/s) |
|---|---|---|
| 0.576 | 0.567 | |
| 5.730 | 5.729 | |
| 57.296 | 57.296 |
The physical roll rate stays exactly : the two angles race together while the aircraft barely moves. Every 3-parameter description of attitude has such a point somewhere (a topological theorem, quoted from memory), so we spend a fourth number.
Quaternions
A quaternion is a scalar and a 3-vector with the product
non-commutative through the cross product, like rotations. A turn by about the unit axis is the unit quaternion , and it rotates vectors by , with . Expanded, it is a matrix with , and so on.
- Composition is multiplication: then is , and .
- Double cover: and are the same rotation, since the signs cancel in . A turn is .
- No singularity: unit quaternions fill the 3-sphere , which has no poles, and is smooth and two-to-one everywhere. The price is the constraint .
Kinematics. In a short the body turns by about its own : , so
Linear, with no division anywhere. The exact flow keeps (the scalar part of is ); a numerical method does not, so codes renormalise, . Because is linear in , a wrong length never feeds back into the direction: renormalising changes no attitude computed from . It matters for code that uses the formula unnormalised, which stretches the body.
The inertia tensor
Particles of a spinning body move at , so the angular momentum about the centre of gravity is
by . The diagonal holds the moments of inertia, ; off the diagonal sit products of inertia like . In general is not parallel to .
is symmetric, so the spectral theorem (1.6) gives real eigenvalues and three perpendicular eigenvectors: the principal axes. Spin about one and points along the spin; in that frame . A uniform box with sides has and cyclic. The sim’s box, m and kg, has kg m.
Worked example: the light aircraft
Assume (rough, invented here) kg in five uniform boxes: engine and propeller (150 kg), cabin with people and fuel (710), a high wing m by m (120), tail cone (70) and tail surfaces (50); the lab cell lists positions and sizes. Shift to the centre of gravity and add each box’s own inertia to its parallel-axis term . The lab cell gets, in kg m,
Left-right symmetry kills and ; the engine low in front and the wing and tail high behind leave . The eigenvalues are , , , and the roll eigenvector tilts nose-down from , along the line the masses lie on. Published Cessna 172 values are about , , kg m (from memory): crude lumps, right order.
Why . The wing’s mass lies far out along , counting in and ; the fuselage’s length counts in and . Yaw pays for both (a flat body has exactly; here against ). A N m moment gives rad/s in roll, in pitch, in yaw: roll is easiest to start.
Euler’s equations
Newton says in the world frame, but is constant only in the body, so write . Each column of is a body axis turning at , so for any body-component vector , : the change seen in the body plus the turning of the frame. With , in body axes:
Euler’s equations. In principal axes with : , , .
Two invariants when . Dot with : , which ( symmetric) says is constant. Dot with : is constant, and in the world frame the whole vector is. An integrator should keep both: free error meters.
Which spins are stable
Spin at about axis 2 and perturb: , all small but . Dropping products of small terms (7.7 Nonlinear Systems & Linearization), , , . Differentiate the first and substitute: with
The Jacobian’s eigenvalues are . If is the largest or smallest moment, the brackets have opposite signs, , the eigenvalues are imaginary and the axis only wobbles. If is intermediate, , both brackets are negative and one eigenvalue is real and positive: a saddle. That is the intermediate-axis theorem.
Numbers (sim readout, rad/s, one turn per second):
- Box: s, so perturbations e-fold every s. About it wobbles at rad/s, about at rad/s.
- Light aircraft about pitch, its intermediate axis: s, e-folding in s.
The flip. In body axes lies on the sphere const and on the ellipsoid . Their intersections are small loops round axes 1 and 3, but through axis 2 they are crossing curves that run to the opposite pole. So the body flips, and flips back, periodically. Start the box at : first changes sign at s, then every s. With a ten times smaller perturbation the first flip comes s later, which is : the growth rate at work. This is the Dzhanibekov effect, after the cosmonaut who saw a wing nut flip every few seconds on Salyut 7 in 1985 (from memory), and the tennis-racket theorem on Earth.
The green world stays fixed while the box turns over; the chart shows swinging between and while and bulge at each flip. The light aircraft, spun about pitch, keeps turning over so that its right wing swings round to where the left one was, and its own pitch rate reverses (first at s).
Integrating it
The state is , seven numbers. The sim’s 20 s check runs the box (, perturbation ) through five flips:
| method, | |||
|---|---|---|---|
| forward Euler, s | |||
| forward Euler, s | |||
| RK4, s | |||
| RK4, s | |||
| splitting, s |
Forward Euler is first order and its energy grows, 39% in 20 s (4.2 The Euler Family: Forward, Backward, Heun & Midpoint). RK4 is fourth order: halving cuts the energy error by . Tick renormalise and drops to round-off while the and columns do not change at all, as the linearity argument predicts.
The splitting method is the rigid-body kick-and-drift of 4.7. Write ; each term alone is an exact rotation about one principal axis at rate . Do half a step of 1, half of 2, a full step of 3, half of 2, half of 1, each exactly. Every piece is a rotation, so is kept to round-off and never drifts. The energy error is second order and, like velocity Verlet’s, oscillates without growing: it peaks at during flips, and press 2000 s check: the peak is the same. RK4’s error is smaller but grows steadily, at 20 s, at 2000 s.
Gimbal lock in an integrator
Now integrate the angles. Fly a loop at pitch rate rad/s with a small body yaw rate , and integrate by RK4 beside RK4 on the quaternion. The body rates are constant, so the exact attitude is one rotation about a fixed axis, with , and the sim measures both errors against it.
The nose passes from vertical. Near the top heading and roll each swing by almost , half of it within about seconds, at peak rates near . For : a miss, s, rad/s.
After one loop with s (251 steps):
| (rad/s) | largest sampled angle rate | Euler-angle error | quaternion error |
|---|---|---|---|
| 0.02 | 12.3 rad/s | deg | |
| 0.005 | 42.2 rad/s | deg | |
| 0.001 | 200.3 rad/s | deg |
The quaternion error does not depend on . The Euler-angle error depends on whether fixed steps resolve a spike about long, and it is erratic: at , less than at , because the steps land differently on the narrower spike. At the right-hand aircraft visibly ends off its outline; at the is too small to see, so read the label. An adaptive step (4.4) would chase the spike; quaternions have none.
Computing it
Graded: energy to and world to over 10 s of the flipping box, the flip, rad/s at , and the loop at , : quaternion within degrees, Euler angles more than off (, as in the table).
Concept checks
Problems
(a) Show that the matrix taking to has determinant . (b) At find a nonzero angle-rate vector giving and interpret it. (c) Which body rates are then unreachable?
Show worked solution
(a) Expand along the first column: .
(b) With , the matrix is , whose kernel contains . With the nose vertical, yaw about world and roll about the nose are the same motion, so equal rates of both cancel.
(c) The column space is spanned by and ; the body rate , perpendicular to both, cannot be produced. Near the lock it needs angle rates of order .
(a) Write the quaternions for a roll and a yaw. (b) Multiply them in both orders and find where the nose goes. (c) What is a roll, and why is it still the identity?
Show worked solution
(a) , .
(b) , a turn about sending : nose east (roll first). sends : nose down (yaw first). Only the term differs, and it flips sign with the order.
(c) . The two signs cancel in , so is the same rotation as .
Key Takeaways
- A rotation matrix’s columns are the body axes in world coordinates: , . Order matters: roll then yaw leaves the nose east, yaw then roll points it down.
- Euler-angle kinematics have determinant : at pitch a rad/s yaw demands rad/s of . Gimbal lock lives in the coordinates.
- Unit quaternions compose by multiplication, double-cover the rotations and obey with no singularity.
- ; the symmetric has orthogonal eigenvectors, the principal axes. Light aircraft (lumped): , , kg m.
- Torque-free, and are conserved: free checks. RK4 ( s) keeps to over 20 s; splitting keeps to round-off.
- The intermediate axis is a saddle: the box e-folds in s and flips every s at one turn per second. Dissipation (Explorer 1) destabilises the minimum axis too.
- Next, 12.4: rotation is now in hand. The six-degree-of-freedom model joins it to the forces and moments of lift (12.1, 12.2) in twelve states, position, velocity, attitude and body rates, advanced by one RK4 loop.