⚠ GIMBAL LOCK — roll and yaw axes are aligned, one control axis is lost
Body X (pitch axis) Body Y (yaw axis) Body Z (roll axis) Target (ghost)

Attitude Control: Quaternion vs Euler Gimbal Lock

Command a target roll, pitch and yaw for a rigid satellite and watch a real PD attitude controller drive it there through genuine quaternion kinematics (q̇ = ½Ω(ω)q), rendered here as a 2D projected gimbal-ring diagram instead of a full 3D scene. Switch between a coordinate-free quaternion controller and a naive Euler-angle controller that runs three independent per-axis PD loops, then push the target pitch toward 90° to watch the projected roll and yaw gimbal rings swing into the same plane — real gimbal lock, with one degree of control freedom lost — while the convergence strip chart below shows the quaternion controller sailing through the same attitude without a hitch.