Skip to content

quaternion rotation backwards? #6

@banyan-in-beijing

Description

@banyan-in-beijing

Hi,
If I understand correctly:

  1. The BNO055's linear acceleration output is in terms of the sensor's local frame XYZ axes, and the purpose of the readAbsAcc() function in BNO055.cpp is to rotate that linear acceleration vector into the absolute/global frame's XYZ axes.
  2. The quaternion output from the BNO055 represents the rotation that must be applied to a fixed initial vector (0,0,0) in the global frame in order to obtain the sensor's current orientation.
  3. When we "apply" a quaternion (q) rotation to a vector (v) by doing qv(q^-1) where (q^-1) is the conjugate of q, we rotate v by the rotation encoded in q.
  4. a rotation specified by quaternion q is the opposite of the rotation specified by conjugate (q^-1). I.e. if v2 = qv(q^-1), then (q^-1)v2q would be equal to v.

If the above are correct, then I think the readAbsAcc() function rotates the linear acceleration vector not back into the global frame but instead doubles the offset from the global frame.
If I am reading the function correctly, it multiplies qr(q^-1) where r is the linear acceleration vector. However, since q is the rotation from the initial (0,0,0) vector in the global frame to the current orientation, not the rotation needed to get to the initial vector in the global frame from the current orientation, I think the readAbsAcc() function instead needs to multiply (q^-1)rq.

I'm not 100% sure of this; please let me know if there is an error in my reasoning.
Thanks!

P.S. Thank you for posting your code! It's helped me a lot in understanding how to use the BNO055.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions