02-24-2019 01:30 PM
I'm using the BNO055 Sensorfusion algorithm to get the orientation in Quaternion of an object in world space. Now I would like to create a local coordinate system by using the gravity vector and by get an acceleration vector in one plane only. Is it possible to calculate the gravity vector from the recieved Quaternion alone (since it is used in its algorithm)?
Solved! Go to Solution.
03-01-2019 08:54 AM
Hi Pvand2019,
the general formulas are described below to get the gravity vector in the sensor frame (typically device/object frame).
gravityVectorNED = [0 0 1];
rotationNED2SF= conjugate(rotationVector)
gravitySF = rotation NED2SF ∙ gravityVectorNED ∙ rotationNED2SF-1
Since we are using unit quaternions for the rotations, the inverse of the rotationNED2SF is equal to the conjugate of the quaternion. The operator ∙ is defined as the quaternion multiplication.
The final equation would be this:
grav_x = 2*(rv_x *rv_z - rv_w * rv_y)
grav_y = 2*(rv_y*rv_z + rv_w*rv_x)
grav_z = rv_w*rv_w - rv_x*rv_x - rv_y*rv_y - rv_z* rv_z
Hope this helps,
Regards,
kgoveas