Quaternions and Euler Rotations Exploration

Hello,

I did an exploration of rotations with quaternions and Euler angles and sharing the “bare bones” code I wrote.

The original project (a year ago) got out of hand and I really need to clean up the code and references and this was a start.

This code was written to test formulas from:
http://www.euclideanspace.com/maths/geometry/rotations/conversions/index.htm

This program:

  1. Generates Euler angles with keyboard control
  2. Euler angles are converted to quaternions
  3. quaternions are converted back to Euler angles
  4. Euler angles are used to rotate a shape

Later I replaced 1 and 2 with serial data (quaternions) from a BNO055 sensor; there was a lot more involved in doing this. :slight_smile:

Code:
https://github.com/glvjr/BNO055

Sensor:

Example video of final project (the one I posted is only keyboard and “minimal”):

Enjoy!

:slight_smile:

8 Likes

That’s beautiful.

I’m using this code from https://code.google.com/archive/p/digital-ahrs/downloads
to display the data but I need what you did with quaternions and euler angles to turn it. I’m using an HMC5883L for the magnetometer data.