Adafruit BNO055 Absolute Orientation Sensor: orientation reading issues

Hi all,
This is my first time posting so please be gentle.

I have been using my orientation sensor to get xyz euler angle data regarding orientation (or yaw, pitch, and roll if you prefer). I am attempting to calculate the change in angle between two orientation sensors in each respective direction. For example, if the first sensor reads 90 degrees in the x direction and the second reads 60 degrees in the x direction, it will calculate 30 degrees.

The issue I have been running into, as I turn the sensor in the z direction (roll), the x and y direction (yaw, pitch) angle values change as well, which affects my calculations at times. I know it is not human error because the change in values for the x & y direction are too large and I did it on a flat surface.

Does anyone know what is causing this? Or do am I just fundamentally misunderstanding an orientation sensor?

Thank you

SD_Project_v4.ino (1.94 KB)

Euler angles are not easy to interpret, except in the simplest of cases (rotation about only one or two axes).

There are 12 different conventions for defining them, so to start with you have to know which convention the sensor firmware uses. This requires you to know the order in which the rotations are applied, and for each angle, which is the rotation axis and what is understood to be a positive rotation.

In the general case a set of angles is useful to identify a particular orientation, but to understand the relationship between two orientations requires more work.

For a decent introduction. see http://www.chrobotics.com/library