Universal Robots Forum

How to rotate w.r.t base frame?

Hello there devs,

I’m developing a C# program that at some point generates an URScript path that is being sent to URSim/UR10e. The generated path is created as a set of points in global space with orientations w.r.t of origin (converted to meters and axis-angle). Robot moves correctly to each point but the problem comes with orientations, I’m not able to use movej,movel,movep with orientations relative to the base frame as needed. In the polyscope interface I can do it manually by selecting the base frame and using the GUI buttons of the left panel but I need to do the same inside the urscript. It seems urscript works with orientations w.r.t. tool: https://www.universal-robots.com/how-tos-and-faqs/faq/ur-faq/explanation-on-robot-orientation-28126/ but I refuse to thing that there’s no simple way of doing this.

In the test I want to tilt the tool around base X-axis while the tool rotates in its Z.

Thank you for your time!

Hi roman,

If you go to the move screen in Polyscope and select the Base as the feature. You will see that the tool position values showing the transformation from the base to the active TCP represented in axis angles and radians. That is the same values you should use for movel or movej.
If you change the feature to tool, you will see the values shifting to p[0,0,0,0,0,0] because it will show the transformation from TCP->TCP.
Do you have a concrete example of where the Polyscope values does not match the script values you have generated?

I’ve solved the issue. Posting here in case it may help other devs
I was creating the matrix used to generate the transformation in C# as EulerXYZ with:
Matrix4.CreateRotationX(x)*Matrix4.CreateRotationY(y)*Matrix4.CreateRotationZ(z);
Then I converted the matrix to AxisAngle to send it over 30002 TCP port as a MoveL/MoveJ

After some testing and research I’ve noticed that in order to fix my issue I had to create the rotation matrix as RPY or Euler ZYX with:
Matrix4.CreateRotationZ(z)*Matrix4.CreateRotationY(y)*Matrix4.CreateRotationX(x);
After converting the matrix to AxisAngle, robot moves as expected!

I am working on something very similar involving a camera with a UR10. I want to align the tool Y-axis with the base Z-axis while the tool rotates in its Z. Could you please explain to me where should I take the X, Y and Z values of the functions Matrix4.CreateRotation?

Answered in TCP alignment with robot base axis !