Niko Natsoulas Home

Attitude Dynamics

Interactively explore spacecraft attitude with quaternions & DCMs

Loading visualization...

Quaternion (scalar-first)


Direction Cosine Matrix

How to Use This Visualization

Mouse Interaction

  • Click and drag to rotate Sputnik freely
  • Any mouse interaction will stop spinning if active

Quaternion Controls

  • Enter values for the scalar-first quaternion [q₀, q₁, q₂, q₃]
  • Click "Apply Quaternion" to update attitude
  • Use "Zero All" or "Reset to Identity" for quick settings

Direction Cosine Matrix

  • Enter values in the 3x3 DCM grid
  • Click "Apply DCM" to update attitude
  • Use the rotation generators for common DCMs
  • Try different angles for X, Y, and Z axis rotations

Angular Velocity (Spin)

  • Scroll down in the controls panel to find spin options
  • Enter values in deg/s for rotation rates around each axis
  • Use preset buttons for common rotation patterns
  • Click "Start Spin" to begin continuous rotation
  • DCM and quaternion values update in real-time during spin

Spacecraft Attitude Dynamics Concepts

Quaternions

Quaternions are a 4-parameter representation of attitude that avoids the singularities found in Euler angles.

q=q0+q1i+q2j+q3k=[q0,q]

Where q0 is the scalar part and q=[q1,q2,q3] is the vector part. For rotation, these relate to axis-angle as:

q0=cosθ2,q=n^sinθ2

Where n^ is the rotation axis and θ is the rotation angle.

Direction Cosine Matrix (DCM)

DCM is a 3×3 rotation matrix that transforms vectors from one coordinate system to another.

C=[C11C12C13C21C22C23C31C32C33]

The columns represent the body coordinate axes expressed in the inertial frame.

From quaternions, the DCM can be computed as:

C=(q02qTq)I3×3+2qqT2q0[q×]

Torque-Free Motion

In the absence of external torques, angular momentum is conserved. For a rigid body, this means:

H˙=0

Where H is the angular momentum. In body coordinates, this leads to:

Iω˙+ω×(Iω)=0

Where I is the moment of inertia tensor and ω is the angular velocity.

Constant Angular Velocity

For bodies with special inertia properties or specific initial conditions, ω can remain constant in body coordinates. Our simulation implements:

ω˙=0

This means the spacecraft rotates around a fixed axis with constant speed, even though the orientation changes continuously.

Quaternion Kinematics

For a rotating body with angular velocity ω, the quaternion evolution is given by:

q˙=12q[0ω]

Where is quaternion multiplication. This differential equation describes how the orientation changes with time.

DCM Kinematics

The equivalent differential equation for the DCM is:

C˙=[ω×]C

Where [ω×] is the skew-symmetric matrix formed from angular velocity:

[ω×]=[0ω3ω2ω30ω1ω2ω10]

Euler's Rotation Theorem

Any rotation can be expressed as a single rotation about some axis. This is the principle behind the axis-angle representation.

R(n^,θ)=I+sinθ[n^×]+(1cosθ)[n^×]2

This is the foundation of both quaternion and DCM representations.

Body Frame Axes

The red, green, and blue axes in the visualization represent the body-fixed coordinate frame:

  • X-axis (red) - Body forward direction
  • Y-axis (green) - Body upward direction
  • Z-axis (blue) - Body right direction

This right-handed coordinate system rotates with the spacecraft.

Attitude Propagation

For the constant angular velocity case, the quaternion at time t is:

q(t)=q(t0)exp(12ΩΔt)

Where Ω is a 4×4 matrix formed from angular velocity components and Δt=tt0.

Polhode Motion

In torque-free rotation, the angular velocity vector traces a path called a polhode when viewed from the body frame.

For principal axis rotation (as simulated here), the polhode simplifies to a single point, meaning ω is constant in body coordinates.