I don't think there's anything wrong with the formula. My guess is that the values are returned in the order, x-y-z-w rather than w-x-y-z as you have described them.

Solved

Posted on 2011-10-27

Hi,

I am trying to determine Eular angles [roll, yaw, pitch] from Quaternions [w, x, y, z] which are being streamed to me from a PS3 Move controller. If I don't rotate the controller and just move it then the eular angles I derive from the quaternions match the controller position. e.g If the quaternions I get back are [w = 0.89, x = 0.37, y = 0.23, z = -0.09] the Eular angles I derive are [roll = 0, yaw = 28, pitch = 46], which is what I expect. Now if I dont move the controller just rotate it around it's own axis then the Eular's I derive from the quaternions suggest that my pitch and yaw have changed. e.g. If I dont move the controller from the earlier mentioned position and just rotate it 35 degress then the quaternions I get back are [w = 0.83, x = 0.29, y = 0.33, z = -0.34] which map out to Eular angles [roll = -20, yaw = 50, pitch = 50]. The answer I am looking for is [roll = 35, yaw = 28, pitch = 46].

The formulas I have tried for conversion from Quaternion to Eular are

yaw = atan2(2*qy*qw-2*qx*qz , 1 - 2*qy2 - 2*qz2)

roll = asin(2*qx*qy + 2*qz*qw)

pitch = atan2(2*qx*qw-2*qy*qz , 1 - 2*qx2 - 2*qz2)

and the one's mentioned on wikipedia

http://en.wikipedia.org/wiki/Conversion_between_quaternions_and_Euler_angles

but I have not had any luck.

Any ideas, suggestions or formula's will be highly appreciated.

Thanks

I am trying to determine Eular angles [roll, yaw, pitch] from Quaternions [w, x, y, z] which are being streamed to me from a PS3 Move controller. If I don't rotate the controller and just move it then the eular angles I derive from the quaternions match the controller position. e.g If the quaternions I get back are [w = 0.89, x = 0.37, y = 0.23, z = -0.09] the Eular angles I derive are [roll = 0, yaw = 28, pitch = 46], which is what I expect. Now if I dont move the controller just rotate it around it's own axis then the Eular's I derive from the quaternions suggest that my pitch and yaw have changed. e.g. If I dont move the controller from the earlier mentioned position and just rotate it 35 degress then the quaternions I get back are [w = 0.83, x = 0.29, y = 0.33, z = -0.34] which map out to Eular angles [roll = -20, yaw = 50, pitch = 50]. The answer I am looking for is [roll = 35, yaw = 28, pitch = 46].

The formulas I have tried for conversion from Quaternion to Eular are

yaw = atan2(2*qy*qw-2*qx*qz , 1 - 2*qy2 - 2*qz2)

roll = asin(2*qx*qy + 2*qz*qw)

pitch = atan2(2*qx*qw-2*qy*qz , 1 - 2*qx2 - 2*qz2)

and the one's mentioned on wikipedia

http://en.wikipedia.org/wi

but I have not had any luck.

Any ideas, suggestions or formula's will be highly appreciated.

Thanks

5 Comments

Thanks for your help

By clicking you are agreeing to Experts Exchange's Terms of Use.

Title | # Comments | Views | Activity |
---|---|---|---|

Tetris download for windows 7 | 17 | 149 | |

Record video from component output to USB ? | 7 | 433 | |

Very bored unfinished Death Star needs revitalization - Java GIF recycle | 7 | 234 | |

Unity 3D: Do Mono Behaviour functions eat resource if you don't define them? | 9 | 24 |

Join the community of 500,000 technology professionals and ask your questions.

Connect with top rated Experts

**8** Experts available now in Live!