Universal Robots Forum

Determined turning direction when moving TCP around 180°


is there a way to get a determimed rotation direction if I want to turn the TCP about 180° degree.
Code could look like this:
ptcp = get_actual_tcp_pose()

Sometimes the robot turns left, sometimes the robot turns right.

Is there a possibility to get a detemined direction ?
My workaround is to split the movement in pieces so the robot is forced to turn in my preferred direction. The downside is, that the robot stops at each of the split movements.

Code could looks something like that
ptcp = get_actual_tcp_pose()

Blending the movements doesn´t work because the position of the TCP is always the same and the blending algorithm doesn´t consider the orientation of the TCP.

Any ideas about another solution or an additional workaround for the blending ?

Thank you
Best Regards,
Alexander Apostolidis

1 Like

movel chooses the shortest path between current pose, and target pose.
Would it be feasible for you application to rotate 179 or 181 degrees?


thank you for your answer.
Perhaps I can try something like 179,999 instead of 180. This should also be shorter.

Independendly of this it would be great if you could give the robot the preferred direction as user input, but I See the problem that you than need 1 input for each joint, what wouldnt be user friendly.

So perhaps you know a better way to bend the rotation movements ? Am I right with my assumption, that the blending algorith does not consider TCP orientation, only TCP Position ? Is there a workaround to get a movement without stop ?

Thank you,
Alexander Apostolidis

If your TCP is only translated along the z-axis, then you could consider just using the PTP motions instead and add the wanted rotation yourself to the current configuration of your robot.
Otherwise you can always use the invkin solver to find the configuration it will want to go to and use it to check if it rotates “the correct way” according to your need.

Hi lcs, thanky for your reply.

How can I rotate a single axis ? I dont know an command that does this.

Your second point: Looking at the target joint-positions and decide if it was the right direction ? That would of course work to prevent a turning in the “wrong” direction but how would I achieve the turning in the “right” direction?


  1. would roughly look like this:
    config = get_actual_joint_positions()
    config[5] = config[5] + 6.28 # + or - depending on direction # number in bracket depends on joint number
    movej(config, a, v, t, r) # replace a,v,r,t with your values
    NOTE: You should make sure that the joint limits are not exceeded after modifying the config

see the pdf “The URScript Programming Language” from the download page

you can iteratively reduce the angle a little from 180 until you find a rotation that yields a configuration that turns your desired direction.
but the above is a lot easier in many cases.


Thanks for the code. Ok, I understand. This will work.

By your reply I noticed that it is better to save positions as joint-positions instead of poses (x,y,z,rx,ry,rz) because poses are not well-defined regarding joint positions, what was/is one weakpoint of my program at the moment! Really helpful. Thanks for this thought-provoking impulse ans sharing your experience.


I did a short test to show the difference between Pose and Joint Positions: Pics attached

Calculation of values