16. Embedded, robotics and real-timeFrames and rotations
Frames and rotations
Frames and rotations are how you describe which way something is pointing and convert between points of view, such as “the drone’s nose” versus “north, east, down.” The intuitive way is three angles, roll, pitch and yaw (Euler angles), but they have a flaw called gimbal lock: at certain orientations two of the angles end up turning about the same axis, so you lose a way to turn and the math misbehaves. Rotation matrices avoid this but use nine numbers to describe three degrees of freedom. Quaternions use four numbers, never lock up, and blend smoothly between orientations, which is why flight software and game engines use them internally.
In this lesson: Rotate an aircraft with Euler sliders until gimbal lock, then switch to quaternions.