KieranWynn / pyquaternion

A fully featured, pythonic library for representing and using quaternions
http://kieranwynn.github.io/pyquaternion/
MIT License
344 stars 72 forks source link

How to initialize Quaternion from yaw, pitch, roll? #51

Closed 0xc22b closed 4 years ago

0xc22b commented 4 years ago

Hi,

Suppose that I get yaw, pitch, roll from method 'yaw_pitch_roll' then I change some values of them. How can I get/initialize a Quaternion object from my updated yaw, pitch, roll?

Please help. Thank you so much.

0xc22b commented 4 years ago

I ended up using this https://www.andre-gaschler.com/rotationconverter/ to get Quaternion's elements from yaw, pitch, roll.

Thank you.

bjajoh commented 3 years ago

It's actually really simple, here the solution for all the future people having the same issue: Quaternion(axis=[0, 0, 1], angle=3.14159265) Note: the angle is in radians. This example initializes a yaw angle of 180°

zhangpur commented 2 years ago

Hi, @bjajoh, is the rotation clockwise or counter-clockwise? I mean the positive direction of the angle. Thanks.

bjajoh commented 2 years ago

@zhangpur Sorry I forgot that, just try it and maybe comment for future people asking the same :)