Create Waypoints in MoveNodes with external Button

Hello,

I’m facing big trouble on how to create waypoints in MoveNodes.

A short explanation of what has to be done by my URCap: I need to create MoveP and MoveJ Nodes with some of the digital inputs of the controller. For example, pushbutton 1 creates a MovePNode with 1 Waypoint. If pushbutton 2 is pressed, another waypoint should be created.

The URCap Node is inserted into the node tree by the operator.
image

As long as this view is open, the URCap will recognize changes to the digital inputs. After pushbutton 1 is pressed it looks like this:
image

So far so good. But i can’t find a way to create a waypoint by pressing pushbutton 2. The tree should look like this:
image

I’m really looking forward for your answers.

Thanks in advance,
Andreas

It might help to take a look at this sample: URCap Sample: Vision Template Builder
Src → PickProgramNodeContribution.java

I would think that the code should look something like this:

TreeNode root = MoveP node
root.addChild(Point_2).

But check the out the API Reference for TreeNode/Program node and the sample.

https://plus.universal-robots.com/api-reference/

2 Likes

Thank you for the hints.
Got it working.

Regards

2 Likes