Universal Robots Forum

Updating and using a feature point in subprogram

I have a subprogram that sets a point feature at the current tool position and then completes a circle move relative to that feature. When running the sub program individually, it works as intended. However, when I run it as a sub program, it seems as if the point feature is never set and the circle move is complete using the originally saved position of the feature.

Here is the subprogram:

  • The door_reference is a point feature in the installation.
  • The MoveP’s feature is door_reference
  • reference is another point feature for the object the UR is interacting with
  • Waypoint Start is p[0,0,0,0,0,0] for the feature door_reference

Here is the main program:

  • reference is updated with the saved point from a global variable
  • All moves use the feature reference

Does anyone know why this is occurring? I would like to keep the subprogram and not merge it into one program since I use the subprogram in other programs.



I just tested calling a subprogram after a else condition and it worked. Are you sure your else condition is executed as intended? You could use a popup to test whether the program even gets into the else condition to see if there is an error with your if(condition).

1 Like

The subprogram executes for me when running (its also called in the if condition). What the problem I’m having is that the MoveP in the subprogram is not using the newly assigned value of door_reference, instead it is using the original value in the installation file.

@justin.knapp have you reviewed the resulting UR script generated by Polyscope?

@justin.knapp I have created a similar program to yours and it ran successfully.
My program completed a circle move-called via a subprogram-based on any location the tool makes contact while in a directional move.

The key takeaways for me to get it working correctly were the following:

  • adding breakpoints at various stages of my program to monitor the modified ‘point feature’ location in the ‘variables’ tab of the programming screen

  • in my program-I created a Point Feature, and based all of my circle moves off of that point feature. and whatever height the contact position of the directional move was, that was then the new Point Feature

  • In particular , I had to specifically create variables for the starting and finishing position (contact position), use a pose_sub function to define the NEW z posn (in my case), and then re-assign that new variable to the point feature

It was not clear to me if these were or were not setup in your program, so I would also check to see if this is something that would solve your issue. In particular-stated in bullet point 1- pay close attention to the values of your variables, as you might have to create some more. Or use different commands to ensure they are getting the updated Z,Y,Z…etc values that you need.

@Ebbe @tywa Thanks for the help. Originally I was using a fixed position waypoint for the positions of the circle move, but after looking through the URScript, I was able to see what was going wrong. As you suggested, using variables worked to have the moves be relative to the point feature.

Thanks again

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.