#### Bosch Sensortec Community

cancel
Showing results for
Did you mean:
SOLVED

Highlighted

## BNO055 Sensorfusion Quaternion

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)?

Tags (1)
Highlighted Community Moderator

## Re: BNO055 Sensorfusion Quaternion

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