Hi,

Does the SDK provide a method to convert a quaternion to euler angles?

Thanks,

-jelle

Hi,

Does the SDK provide a method to convert a quaternion to euler angles?

Thanks,

-jelle

Actually, what I was looking for is the Roll, Pitch, Yaw from a Rotation || Quaternion.

I’ve come up with the following method, based on the .GetRPY() method found here

def rpy_from_quat(vX,vY,vZ, degrees=False):

```
data = [
vX.x(), vX.y(), vX.z(),
vY.x(), vY.y(), vY.z(),
vZ.x(), vZ.y(), vZ.z(),
]
epsilon = 1E-12
pitch = math.atan2(-data[6], math.sqrt( (data[0]) ** (data[0]) + (data[3]**data[3]) ))
if math.fabs(pitch) > (M_PI / 2.0 - epsilon):
yaw = math.atan2(-data[1], data[4])
roll = 0.0
else:
roll = math.atan2(data[7], data[8])
yaw = math.atan2(data[3], data[0])
if degrees:
return map(math.degrees, (roll, pitch, yaw))
else:
return roll, pitch, yaw
```