How to use Fusion library function to get pitch and roll

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to use Fusion library function to get pitch and roll

Jump to solution
1,121 Views
a8Chcx
Contributor V

Hi,

 

I am trying to use fusion library based K64F and Multi2-B to calculate the pitch and roll based on the reference of 0 YAW to see if the real measurement pitch and roll are accurate enough?

ex. I have pitch=30 degrees, roll=50 degrees @YAW=0, then, I want to calculate pitch & roll @ yaw=75 degrees. Is it possible to call any function in library to get these angles?

 

Thanks,

 

Christie

Labels (1)
0 Kudos
1 Solution
640 Views
markpedley
NXP Employee
NXP Employee

Assuming the Aerospace coordinate system, the sequence of Euler angle rotations is:

First, the yaw rotation which is about the vertical z axis

Second, the pitch rotation iabout the y axis

Third, the roll rotation about x axis.

I think you're referring to performing a fourth rotation about the z axis. The z axis was the yaw axis at the start of the rotation sequence but it's no longer the yaw axis as a result of the roll and pitch rotations.

To perform a fourth rotation about the z axis by angle psi, pre-multiply your orientation matrix R by the z axis rotation matrix Rz)psi) (equation 3 in AN5017) to obtain a new orientation matrix Rz.R:

Rz(psi)={cos(psi), sin(psi), 0}

{-sin(psi), cos(psi), 0}

{0, 0, 0}

From the new rotation matrix Rz.R you can extract the new Euler angles with a call to: fNEDAnglesDegFromRotationMatrix

Mark

View solution in original post

0 Kudos
6 Replies
640 Views
a8Chcx
Contributor V

Hi Mark,

Thanks.

Christie

0 Kudos
640 Views
markpedley
NXP Employee
NXP Employee

There's a small typo in my reply: the z axis rotation matrix obviously has a 1 and not a 0 in the [z][z] position.

The correct matrix is:

Rz(psi)={cos(psi), sin(psi), 0}

{-sin(psi), cos(psi), 0}

{0, 0, 1}

0 Kudos
640 Views
markpedley
NXP Employee
NXP Employee

The yaw rotation occurs first in all three coordinate systems that are supported in the software. Changing the yaw angle therefore has no effect on roll and pitch angles. Any initial yaw rotation has no effect on the accelerometer measurement since all accelerometers are insensitive to rotation about the vertical axis.

0 Kudos
640 Views
a8Chcx
Contributor V

Hi Mark,

It should be changed on pitch & roll on tilted surface when I turn YAW only?

Ex. You have pitch=30 roll=50 and turn YAW 180 degrees on tilted surface, after turn, pitch will be -30 degree, roll will change as well, right?

Can I use any function in fusion library to get pitch & roll?

Thanks,

Christie

0 Kudos
641 Views
markpedley
NXP Employee
NXP Employee

Assuming the Aerospace coordinate system, the sequence of Euler angle rotations is:

First, the yaw rotation which is about the vertical z axis

Second, the pitch rotation iabout the y axis

Third, the roll rotation about x axis.

I think you're referring to performing a fourth rotation about the z axis. The z axis was the yaw axis at the start of the rotation sequence but it's no longer the yaw axis as a result of the roll and pitch rotations.

To perform a fourth rotation about the z axis by angle psi, pre-multiply your orientation matrix R by the z axis rotation matrix Rz)psi) (equation 3 in AN5017) to obtain a new orientation matrix Rz.R:

Rz(psi)={cos(psi), sin(psi), 0}

{-sin(psi), cos(psi), 0}

{0, 0, 0}

From the new rotation matrix Rz.R you can extract the new Euler angles with a call to: fNEDAnglesDegFromRotationMatrix

Mark

0 Kudos
640 Views
a8Chcx
Contributor V

Thanks, Mark.

0 Kudos