Universal Robots Forum

Direction command with custom frame


I don’t understand the behaviour of the Direction command in this example:

The first Direction on line 7 works as expected with a move in Y- relative to Plane_1.

But for the second one, the displacement is relative to Y+ of the Base and not Plane_2.

What did I missed?


After some additional tests, it appears that the Direction command does not take into account the transformations applied in the code. It always use the values defined in the installation.

Can someone confirm this?

Same issue.

I look at the script and it seems direction mode use constant plane and not variable plane.

I am trying to redo the function, but I have some issue. Do you have any news from your part?

Ok, I rewrote the direction function in script, and it is working. Let me know if you want some help.

Hi @pgy,

Welcome to the UR community.

The implementation of Direction uses Plane_X_const and is there by not affected by your modification.

If you have a variable feature. You should also be able to use the it by selecting the Direction vector option and then insert the an expression like this:

pose_sub(pose_trans(Feature_X, Direction_vector), Feature_X)

Best regards

@rsm, thanks.

Did you write your own Direction function or is it possible to alter the behaviour of the built-in one?

@Ebbe, thanks for the reply.

But you are saying that Direction always refers to the orientations defined when created and not the current ones? If so, it’s a bit strange.

Not it exactly when created. You can change it in Polyscope before the program execution is started. But when the program is started, Polycope have used the value to generate the script for the controller. This article might assist you with gaining insight to the structure:


I wrote my own function inspiring by the UR function.

essai_palpage.urp (1.7 KB)

You can try it, it is half english, half french. But I think, you can understand and it can inspire you.

Just trying on my UR3e and it’s working good!

The arguments of this function is only plane and direction. So be careful about speed, and there is no retract, because I did not need it for my part.

Have a good day


@rsm, thanks, will try. Et en français ça ira bien ! :slight_smile:

Post Scriptum : my function is working with the tool contact, I saw you are using distance. If you need me to custom my function for a distance application, let me now