Create linked waypoints programmatically

Hello everyone,

In order to build a template from the backend, I have the requirement to insert MoveJ commands with linked waypoints at two different points of the program tree.
In other words, I’d like to create something like the following image with the SDK:
image

I tried creating a single waypoint assigned to two different MoveJ nodes, but doing so throws an exception. I also tried creating two different waypoints with the same name, but the second one is automatically renamed when I insert it.

Is there a way to create linked waypoints with the SDK? Thanks in advance!

EDIT: I also found that I could define a feature point and then create two waypoints using that variable, but what I’m really looking for is something that can be edited by the user within the command screen, just like with a pair of fixed position waypoints inserted manually.

1 Like

This is a very relevant question, and I want to present another use-case: Consider two instances of the existing Stack template:
image
By default, both instances share the same StartPos Waypoint, i.e. they are linked together:
image
but the user has the ability to unlink them if desired, and have two distinct waypoints, with different names and data. This is great, and we also want to do this.

This is possible for first-party templates, like Stack, which is developed by UR. My question is whether this is possible (and how) for third-party templates that interact with Polyscope via the SDK.

Summarizing, being able to link waypoints programmatically is very useful for any non-trivial template implementation, both for:

  • Linking waypoints from different nodes of a single template instance (the use-case of the original post).
  • Linking waypoints from multiple instances of the same template.
1 Like

Just for the record, I found a workaround for the first use case mentioned above:

  • Generate a fixed-pose waypoint (reference_pose). The generated script will create a global variable (reference_pose_p) with the pose defined by the user.
  • Generate a global variable (reference_pose_v) and assign to it the value of the fixed pose (reference_pose_p).
  • Generate a variable-pose waypoint making use of reference_pose_v.

While this works for a simple use-case like the one described in my first post, eventually we will want to create more than one template instance in the same robot program, and the automatically generated waypoints could potentially be different between templates instances.
On the other hand, the variable waypoints will have a different name than the fixed ones, which can be confusing to users.

All in all, the capability of generating linked waypoints from the SDK would be a better solution for both use-cases.
@jbm shall we consider filing a feature request for this, or is there a way to create linked waypoints that we are missing?

1 Like

Hi @jubeira and @adolfo

It is currently (API 1.7) not possible to link Fixed Waypoints in the API.

You can create Variable Waypoints, that use the same Variable, which will result in a similar functionality to linking.
However they would not have the functionality of Fixed Waypoints, such as Move Here, Set Position, etc.

Please file a Feature Request if this functionality is required.

2 Likes

@jubeira, @jbm

+1 for feature request for Variable Waypoints with Move Here, Set Position, etc. functionality!

@ellingsen.harald here’s the link to the feature request in case you are interested in upvoting it: Create linked waypoints using the SDK.

Note that this workaround is only possible for Polyscope 5. In Polyscope 3, reference_pose_p is not created, but instead, the waypoint numerical coordinates are hardcoded in the script. This is preventing us from porting an upcoming URCap version to Polyscope 3.