Optimization on Quaternions

Jul 16, 2024

Lecture Notes: Optimization on Quaternions

Summary from Last Lecture

  • Topics Covered: Deterministic optimal control algorithms, LQR vs. MPC, DDP (indirect methods).
  • Introduction to Quaternions: Crash course on quaternions.

Today's Topic: Optimization on Quaternions

Recap

  • Quaternions: 4D unit vectors used for representing rotations.
  • Multiplication Rules: Analogy to matrix multiplication.
    • Use an asterisk ( ) for quaternion multiplication.
    • Product includes both dot and cross products.

Special Unitary Group (SU(2))

  • SU(2): 2x2 complex matrices; quaternions fit in this group as the double cover of SO(3).
  • SO(3): Represents 3D rotations. Quaternions represent a double cover, meaning two quaternions correspond to each physical rotation.

Geometric Insight

  • Quaternions as 4D Unit Vectors: Can be thought of as lying on a 3-sphere (surface of a sphere in 4D space).
  • Tangent Planes: The derivative of a quaternion (Q dot) lives in the 3D tangent plane to the 3-sphere at that point.

Kinematics & Multiplication

  • Q Dot (Time Derivative): Lives in the tangent plane, can be expressed in terms of quaternion multiplication (kinematic equation).
  • Conjugate & Skew-Symmetric Matrix: Conjugate of a quaternion gives the opposite rotation.

Attitude Jacobian (G of Q)

  • Infinitesimal Rotations: Small angle approximations to facilitate differentiation.
  • Jacobians: Perturbations show up with Jacobians to map the 3D tangent vectors back to 4D quaternions.
  • Multiplicative Update: Always keeps quaternions valid by using matrix-vector multiplication.

Differentiation

  • Derivatives of Rotations: Even if quaternion-based, derivatives live in a 3D tangent space.
  • Composing Derivatives: Use attitude Jacobians (G of Q) to map derivatives.
  • Hessian: Second derivative for scalar-valued functions involves additional terms to account for curvature.

Optimization Algorithm

  • Setting Up: Think of derivatives as vectors with extra Jacobians to handle rotation specifics.
  • Levenberg-Marquardt Method: Modified Newton’s method for least squares problems involving quaternions.
  • Attitude Updates: Always use multiplicative updates to ensure unit quaternion constraints are preserved.

Example: Wahba’s Problem (Attitude Determination)

  • Given: Known vectors in world frame, observed vectors in body frame.
  • Objective: Minimize least squares error to determine robot’s attitude.
  • Residual Vector: Represents errors between observed and known vectors.
  • Jacobians: Differentiate residual vector w.r.t quaternions, apply attitude Jacobians.
  • Algorithm: Implement Gauss-Newton method iteratively to minimize least squares error.

Practical Considerations

  • Initialization: Random initial quaternion, guaranteed unit norm by normalization.
  • Convergence: Iteratively update quaternion using calculated steps until convergence criteria are satisfied.
  • Double Cover Issue: Be aware of conventions; may need to handle unwinding problems in control applications.

Key Takeaways

  • Quaternions: Powerful for representing and optimizing rotations, despite their complexity.
  • Multiplicative Updates: Ensure unit quaternion constraints and avoid numerical instability.
  • Differentiation Strategy: Use normal vector differentiation, followed by attitude Jacobians to map results.

Applications Beyond Lecture

  • Control Systems: Attitude estimation, spacecraft orientation, robotics, etc.
  • Further Research: Explore deeper into Lie groups and algebras for advanced applications.