Skip to main content
Jonathan Andrei
Back to all posts
Feb. 2022 - Apr. 20224 min read

Quaternions, IMUs, and a Wireless C++ App That Doesn't Lie About Drift

Reading IMU data over wireless and turning it into a stable 3D rotation in OpenGL is mostly an exercise in fighting drift honestly. The hardware lies; the math tells you when.

C++IMUOpenGLQuaternions

Most beginner mocap projects integrate gyro readings into Euler angles and watch the model spin off into the void after two minutes. Quaternions plus an honest sensor-fusion step (accel for tilt, mag for heading, gyro for short-term) buys you a usable signal for as long as the user keeps moving.

Cross-platform was the discipline

Building the same C++ app on Linux, macOS, and Windows forced an honest separation between transport, sensor parsing, and rendering. It's the kind of structural cleanup you only do because you have to, and it's the only reason the code is still understandable years later.

Related project

Wireless Motion Capture Rotation

View the project