Home› Programming
Discussion
Back to discussions page
How to rotate UR5e with respect to base frame 
95 views

Answered  
/ Most recent by ukindler
in Programming

9 comments 
ukindler
Unconfirmed Posts: 3 Apprentice
in Programming
Hi,
in our PC based UR robot application we would like to provide a control panel for manual robot control of an URe robot like you know it from the UR robot teach pendant. That means the user should be able to manual move the robot in tool space (with respect to tool) and in base space (wrt base). We are almost there. We use the servoj command to implement this kind of control. To do this, we manipulate the pose that is given in cartesian space and then convert this with the get_inverse_kin function into joint position that are passed to the servoj function (see the thread jog_thread(): function here: https://gitlab.com/gitlabuser0xFFFF/ur_rtde//blob/uk_dev/scripts/rtde_control.script).
A UR robot pose is given as p[x,y,z,ax,ay,az], where x,y,z is the position of the TCP, and ax,ay,az is the orientation of the TCP, given in axisangle notation. The x, y and z coordinates are seen from the Base position whereas the Rotation (ax, ay, az) of the Tool head is seen from the tool head position itself. To move with respect to the base frame, we can simply add a value to the x, y, z coordinate of a pose. To move with respect to the tool, we use the pose_trans function like it is written here (https://www.universalrobots.com/articles/ur/urscriptmovewithrespecttoacustomfeatureframe/). To rotate with respect to the tool, we can simply add an angle to the ax, ay and az part of the pose. This all works perfectly fine. But in the teach pendant it is also possible, to rotate with respect to the base frame. And this is something that we do not know how to implements this. That means, we do not know, how to translate a pose rotation wrt to the tool into a rotation wrt to the base frame.
in our PC based UR robot application we would like to provide a control panel for manual robot control of an URe robot like you know it from the UR robot teach pendant. That means the user should be able to manual move the robot in tool space (with respect to tool) and in base space (wrt base). We are almost there. We use the servoj command to implement this kind of control. To do this, we manipulate the pose that is given in cartesian space and then convert this with the get_inverse_kin function into joint position that are passed to the servoj function (see the thread jog_thread(): function here: https://gitlab.com/gitlabuser0xFFFF/ur_rtde//blob/uk_dev/scripts/rtde_control.script).
A UR robot pose is given as p[x,y,z,ax,ay,az], where x,y,z is the position of the TCP, and ax,ay,az is the orientation of the TCP, given in axisangle notation. The x, y and z coordinates are seen from the Base position whereas the Rotation (ax, ay, az) of the Tool head is seen from the tool head position itself. To move with respect to the base frame, we can simply add a value to the x, y, z coordinate of a pose. To move with respect to the tool, we use the pose_trans function like it is written here (https://www.universalrobots.com/articles/ur/urscriptmovewithrespecttoacustomfeatureframe/). To rotate with respect to the tool, we can simply add an angle to the ax, ay and az part of the pose. This all works perfectly fine. But in the teach pendant it is also possible, to rotate with respect to the base frame. And this is something that we do not know how to implements this. That means, we do not know, how to translate a pose rotation wrt to the tool into a rotation wrt to the base frame.
Is there something like the pose_trans function to translate a rotation wrt to tool into a rotation wrt to base? Or does someone know the math how to do this? Or does someone know, how this functionality is implemented in the teach pendant.
Thanky in advance for any help.
Uwe
Tagged:
Best Answers

jelms Posts: 34 HandyWell I repeated the same mistake and misunderstood.
Third time is the charm?p1=p[0,0.5,0.5,2.22,0,0] movel(p1) textmsg("p1 ", p1) pr=p[0,0,0,0,0,1.57/2] p2=pose_add(p[p1[0],p1[1],p1[2],0,0,0], pose_trans(pr, p[0,0,0,p1[3],p1[4],p1[5]])) textmsg("p2 ", p2) movel(p2) p1=p2 p2=pose_add(p[p1[0],p1[1],p1[2],0,0,0], pose_trans(pr, p[0,0,0,p1[3],p1[4],p1[5]])) textmsg("p2 ", p2) movel(p2) p1=p2 p2=pose_add(p[p1[0],p1[1],p1[2],0,0,0], pose_trans(pr, p[0,0,0,p1[3],p1[4],p1[5]])) textmsg("p2 ", p2) movel(p2) p1=p2 p2=pose_add(p[p1[0],p1[1],p1[2],0,0,0], pose_trans(pr, p[0,0,0,p1[3],p1[4],p1[5]])) textmsg("p2 ", p2) movel(p2)

ukindler Unconfirmed Posts: 3 Apprentice@jelms Wow, awesome  I think this is the solution. I just tested it and it works like the manual jogging. That is really great and you helped me a lot  to solve the problem and to learn more about pose_trans, pose_add and the math. Thank you very much for your kind help@matthewd92 Thank you for testing this and for your time to help me.You guys are great !!!
You should be able to use pose_trans to accomplish this. A pose p[x,y,z,ax,ay,az] describes the TCP completely in base coordinates. Your statement makes me believe this is a misunderstanding.
whereas the Rotation (ax, ay, az) of the Tool head is seen from the tool head position itself
I picked a somewhat arbitrary start position and then, this will rotate by 90 degrees around the base zaxis. I commented out the moves, but poses will be logged on the log tab.
Hope that helps.
p2 [0.49999985098838806, 0.0003981371410191059, 0.5, 3.1401495933532715, 0.001250210334546864, 0.0022622691467404366]
p1 [0,0.5,0.5,2.22,2.22,0]
p2 [0,0.5,0.5,0.00125029,3.14015,0.00226231 ]