I am trying to track the inclination of a phone device during motorcycle rides. As I am using Expo, I use the library expo-sensors and DeviceMotion. From DeviceMotion I get rotation as Euler angles which contains alpha, beta and gamma, as rotation around Z, X and Y axis in radians.
My goal is to calibrate the phone when starting to ride, and then calculate the angle of inclination.
I am a beginner in maths, so I am not familiar with Euler angles and quaternions calculation.
I found some code to calculate quaternions from Euler angles (https://codepen.io/shlomi-schwartz/pen/gNXaGZ?editors=0010) to display device in the world, but that doesn't help me much.
let q = Quaternion.fromEuler((ev.alpha) * rad, (ev.beta) * rad, ev.gamma * rad, 'ZXY');
I expect to find a way to calculate inclination between a certain inclination of the device and the start position of the phone device.
Any help is welcome, thanks in advance :)