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:
- Generates Euler angles with keyboard control
- Euler angles are converted to quaternions
- quaternions are converted back to Euler angles
- 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.
Code:
https://github.com/glvjr/BNO055
Sensor:
Example video of final project (the one I posted is only keyboard and “minimal”):
Enjoy!