Hello,

I am working on an application for the HoloLens that controls the hologram of a UR10 robot.

In addition, I would like to transfer the data generated with the hologram to the real robot.

To do this I ask in Unity the pose (position and orientation) of the end effector. This can be transferred to the real robot with a separate Python script.

The problem occurs in orientation:

Unity uses a left-handed coordinate system (LH). In addition, Transform.eulerAngles has a specific order (**Z, X ‘, Y’’ in LH**):

The x, y, and z angles represent a rotation z degrees around the z axis, x degrees around the x axis, and y degrees around the y axis.

In contrast, the robot operates in a right-handed coordinate system (RH) and processes Euler angles in the order **X, Y ‘, Z’’ (in RH)**.

Does anyone have an idea how to transfer the first to the second Euler convention?

Is there an alternative possibility to get a **rotation matrix** via script to determine the **rotation angles** (not EulerAngles → without any order).

I hope that was reasonably clear.

Thank you very much!

Rotation isn’t stored in a matrix.

It’s stored in a Quaternion in the ‘transform.rotatoin’ property:

You can unwrap the quaternion in whatever manner you’d like. You’re just going to have to write your own algorithm to do it.

Also… there’s no way to get the ‘rotation angles’ of pitch yaw and roll without them being euler angles. They are by definition euler angles when you have pitch roll and yaw. Also, they must be in a specific order. It’s why Quaternion’s exist in a mathematical sense, it solves the problem of euler angles being interdependent on order.

Just in case that somebody has the same problem: Universal Robot works with a rotation vector, which is an axis–angle representation of a rotation. Unity supports this representation too. It is possible to get the angle and axis with

`transform.rotation.ToAngleAxis(out angle, out axis)`

Unity - Scripting API: Quaternion.ToAngleAxis

Universal Robots - Explanation on robot orientation

For the UR robot it might be necessary to

- convert angle from degree to rad
- change y and z axis
- multiply the axis vector with -1 (rotation direction)

before sending data

1 Like