I had an Orient3D sensor from I-CubeX hoping to get the Yaw in addition to the Pitch and Roll (GForce3D-3 is getting)
I get the Yaw, Pitch and Roll using I2C mode as stated in the user manual
Heading = arctan( Sx / Sy )
Pitch = arctan( Sx / Sz )
Roll = arctan( Sy / Sz )
so now all 3 angle I am getting is in range of -180 degree to +180 degree (am I getting the correct range?)
the problem is whenever Pitch or Roll is changed ( OR both is changed ), the Yaw will change also.
For example, if I face north direction, the Yaw should be fixed no matter the pitch angle is 45 degree (pointing up to sky) or 0 degree (horizontal to the ground) correct?
but for the Orient3D sensor, when ever Pitch or Roll is changed, even the Yaw direction is fixed (pointing north), the Yaw value is changed too.
What I thought was Yaw value will be fixed if only Pitch and Roll angle is changing, but the fact is when ever I have any movement, all Yaw, Pitch and Roll will change also.
Yaw – Rotation about the Z axis
Pitch – Rotation about the X axis
Roll – Rotation about the Y axis
So if I rotate the Orient3D sensor along the X axis or Y axis, Yaw value should not change at all right?
But the fact is whenever I have any movement Yaw, Pitch and Roll all changing at once (even no Z-axis rotation)
did I miss anything as described above or there is something wrong in my code?
The code in Java is something like follows:
double yaw = Math.atan2((double) xInt, (double) yInt); // range -180 to +180
double pitch = Math.atan2((double) xInt, (double) zInt); // range -180 to +180
double roll = Math.atan2((double) yInt, (double) zInt); // range -140 to +140
Orient3D sensor problem ( Yaw, Pitch and Roll )
Moderator: Tech