*01.00* About Welcome to quaternion.cafe! A portal into the world of sensor fusion with quaternions. This vim-inspired tutorial has interactive code editors and 3D visualizations scattered throughout. The content is centered around fusing and integrating a gyroscope with an accelerometer, and explains (with code) how to accomplish this task. All the visualization use real datasets from an actual IMU to illustrate some of the concepts. I spent the last 5 years making this IMU-based telescope accessory (looking for beta testers!) and during that time I had to learn everything from scratch. The knowledge has been synthesized. Beep boop. And thus I created quaternion cafe. There's a lot of information about sensor fusion nobody seems to talk about, so I'm trying to fill some gaps. Table of Contents *02.00* Quaternions? What is a quaternion? Well, don't be alarmed, but a quaternion is a 4D representation of a rotation in 3D space. It contains a scalar component (often denoted as w) and a 3D vector. Putting it together, you get: (w,x,y,z). Quaternions are used heavily in many industries such as computer graphics, video games, virtual-reality headsets, and more. Why? Avoids gimbal lock that's notorious with euler methods Fast to compute. It's just a couple multiplications in a trench coat Smooth interpolation! You can slerp between orientations There are some disadvantages too. They are slightly bigger than euler angles and the numbers make less sense to humans. But much like hobbits, you can learn the basics in a few pages but after a lifetime of application, Quaternions may still surprise you! *02.01* The Basics So if a quaternion has 4 components (w,x,y,z), what does each number mean? Quaternions are similar to the axis-angle representation of rotation, but they are encoded a little differently. Where axis-angle is the rotation amount and the direction of rotation (θ,n̂) a quaternion is [cos(θ/2), sin(θ/2)n̂]. Here's a little function that might explain it better. /* Pr...
First seen: 2025-08-15 17:22
Last seen: 2025-08-16 01:24