Home▸Space & Astronomy▸Attitude Control: Quaternion vs Euler Gimbal Lock

Attitude Control: Quaternion vs Euler Gimbal Lock

A 2D projected gimbal-ring diagram and convergence strip chart comparing a coordinate-free quaternion PD attitude controller against a naive per-axis Euler-angle controller that loses a degree of freedom in real gimbal lock.

Space & Astronomy2DAdvanced60 FPS📱 Mobile-adapted⇄ 3D version
2d-space-tech-topic-15 ↗ Open standalone

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.

⚙ Under the hood

A 2D projected gimbal-ring diagram and convergence strip chart comparing a coordinate-free quaternion PD attitude controller against a naive per-axis Euler-angle controller that suffers real gimbal lock near 90° pitch.

attitude controlquaterniongimbal lockPD controllerspacecraft ADCS2d

2D · HTML5 Canvas 2D · 60 FPS target · runs fully client-side, no install

What did you find?

Add reproduction steps (optional)