Skip to main content

Module quaternion

Module quaternion 

Source
Expand description

Symbolic quaternion algebra for attitude representation. Symbolic quaternion algebra for attitude representation.

Quaternions are represented as q = w + x·i + y·j + z·k where w, x, y, z are symbolic expressions (Ex). This module provides:

  • Hamilton product (*), addition/subtraction, scalar multiplication
  • Conjugate, norm, inverse, normalisation, dot product
  • Conversion to/from 3×3 rotation matrices (Shepperd’s method)
  • Conversion to/from axis–angle and Euler angles (EulerConvention from the robotics module)
  • Rotation of vectors, spherical linear interpolation (slerp)
  • Quaternion exponential, logarithm and powers
  • Quaternion kinematics (q̇ = ½ q ⊗ ω) and differentiation

§Conventions

  • Rotations act on column vectors as v' = q ⊗ (0, v) ⊗ q*, which matches to_rotation_matrix (v' = R v) and the right-handed rot_x/rot_y/rot_z matrices of robotics.
  • Methods documented as assuming a unit quaternion do not normalise their input; call normalize first when the norm is not provably one.

Structs§

Quaternion
A symbolic quaternion q = w + x·i + y·j + z·k.

Enums§

EulerConvention
Euler angle convention for rotation composition.