Tool 12 · Attitude Dynamics

Quaternion / Euler / DCM Converter

Convert spacecraft attitude between Euler angles, quaternions, and direction cosine matrices. This tool also shows the gimbal-lock risk that appears when Euler pitch approaches ±90°, making it useful for GNC and 6DOF simulation work.

What this tool computes

Attitude can be represented in several mathematically equivalent ways. This converter uses a 3-2-1 yaw-pitch-roll convention and computes the equivalent quaternion and DCM.

  • Euler angles: yaw \(\psi\), pitch \(\theta\), roll \(\phi\)
  • Quaternion \([q_0, q_1, q_2, q_3]\)
  • Direction cosine matrix
  • Gimbal-lock warning for Euler-angle singularity
  • Simple 3D body-axis visualization

Euler angles

Euler angles are intuitive because they resemble yaw, pitch, and roll commands. However, they are sequence-dependent and can become singular.

\[ C = R_x(\phi)R_y(\theta)R_z(\psi) \]

In a 3-2-1 convention, pitch near \(\pm 90^\circ\) causes yaw and roll to lose independent meaning.

Quaternion attitude

Quaternions avoid Euler-angle singularities and are widely used in spacecraft simulation, estimation, and control.

\[ \mathbf q = [q_0, q_1, q_2, q_3]^T, \qquad \|\mathbf q\|=1 \]

The scalar-first convention is used here: \(q_0\) is the scalar component and \(q_1,q_2,q_3\) are vector components.

Why this matters for GNC

  • Euler angles are useful for interpretation and display.
  • DCMs are useful for frame transformations.
  • Quaternions are preferred for propagation and onboard control.
  • Gimbal lock explains why a simulation may fail even when the physics is correct.

Convention warning

Attitude conventions vary across textbooks and software. Always state rotation order, frame direction, and quaternion ordering.

Interactive converter

Quaternion uses scalar-first convention: [q0, q1, q2, q3].
Use the gimbal-lock preset to see why Euler angles can become dangerous near ±90° pitch.

Results

Euler angles

Quaternion

Quaternion norm

Gimbal-lock status

Direction Cosine Matrix

Interpretation

Convert an attitude to inspect equivalent representations and singularity risk.

Body axes after rotation

Assumptions and limitations

This converter assumes:

  • 3-2-1 yaw-pitch-roll Euler sequence
  • Scalar-first quaternion convention
  • Passive/active convention is kept internally consistent for visualization
  • No attitude dynamics are propagated on this page