psiphi75/ahrs

Axis rotation

Closed this issue · 2 comments

Hello dear friend,
i was playing around with this module since I wanted to get quaternion then rotation matrix and then acceleration in world frame and I keep getting strange results. I then came back and saw that my axis are wrong, if I understood you correctly this is axis layout:

4-Roll-pitch-yaw-heave-sway-surge-of-a-ship

And i want to use this to calculate from data on smartphone, my smartphone has these axis:

Figure1

I am not sure if these axis has some sort of marking like XYZ or YXZ and I am having difficulties to understand how can axis from smartphone can be rotated into axis for this algorithm. I would really appreciate if you can just point me where to look for. Thanks :)

I've updated the documentation to give a clearer idea of the orientation.

For the phone to match the orientation of the AHRS algorithm, you can rotate every sensor's values around the z-axis, 90 degrees anti-clockwise. This can be done like this:

const rotatedAccel = {
    x: accel.y,
    y: -accel.x,
    z: accel.z
}

Thank you very much, I saw yesterday, one issue where you guys discuss this.