# Manual quaternion example gives me a different result? What am I missing?

Just in general:

If i try run the example below i have a different result than the manual:

Mine is 1.93185, 0, 0.517638, 0.

Am i making a mistake? Is the example correct? Any input appreciated

double q1 = sqrt(cos(0.523599)+ 1 + cos(0.523599) +1);

double q2 = sqrt(cos(0.523599) -1 - cos(0.523599) + 1);double q3 = sqrt(1 - cos(0.523599) - cos(0.523599) + 1);

double q4 = sqrt(cos(0.523599) - cos(0.523599) -1 + 1);

## Comments

const robtarget test2_2_l0:=[[4.18, -29.71, 10.26], [0, 0.2588223, 0, 0.9659249],[-1,0,-1,0], [9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]]

The data type orient has the following components:

q1

Data type: num

Quaternion 1.

q2

Data type: num

Quaternion 2.

q3

Data type: num

Quaternion 3.

q4

Data type: num

Quaternion 4.

As there is a RAPID function EulerZYX which obtains the rotation angles from the quaternions and OrientZYZ that build the quaternions.

So I went online found a converter which used ZYX for the Euler input and plugged in 30,0,30 - got a completely different result to the manual extract!

So had a good look at the diagram of the robot diagram in your extract from the manual it looks like a 30° rotation round the Y axis.

You plug those numbers into the converter ( z= 0, y=30, x=0) you get the result shown in the manual.

What was the manual you got the extract from and I will raise it as a correction?

3.37. orient - Orientation

RobotWare - OS

Technical reference manual

RAPID Instructions, Functions and Data types