This might be a more "mathematical" or "algebraic" question, but I hope you can help me.
My project consists of a tiny device that gets attached to a stick. That tiny device includes a BHI260AB and an STM32 acting as the SPI host MCU.
The idea is that the user presses a button when the stick is in an horizontal position and which is considered the reference orientation.
Ideally the X axis would coincide with the gravity, but since this position is set manually that wouldn't be the real case.
Anyway, the stick is then moved and the device must show on a display in real-time the following two angles:
V and H are the angles that I must show on the display.
V angle is the angle between the initial reference orientation and the XY projection of the actual orientation.
H angle is the angle between the initial reference orientation and the ZY projection of the actual orientaiton.
I have the BHI260 running and I can configure any available virtual sensor successfuly. I'm now just using the Game Rotation Vector sensor, but I'm not sure how can I get the final H and V angles using the reference orientation set by the user.
Which would be the right approach to this?