Universal Robots+

WaypointNode getPose()

I just started playing with PolyScope 3.5/SDK 1.2 and it looks like there is a fair amount of exposure for the built in nodes (move, waypoint etc). I can see that I am now able to traverse down the tree from my program node. It would be very nice to be able to nest the native (UR) program nodes within our URCap’s ‘reference point wrapper node’. This would allow users to put one of our nodes in, then just keep programming as they are used to with the native node types.

I’m looking through the classes and I do not see a way to get a WaypointNode’s Pose. For example, if I traverse through my children nodes and I come across a WaypointNode, the interface does not expose anything that allows me to get the pose (something like node.getConfig().getPose()) but the interface for WaypointNodeConfig (which is what getConfig() returns). I feel like I am missing something but I do not see a way to get this info.

You can get pose for defined fixed waypoint nodes. Look at FixedPositionDefinedWaypointNodeConfig interface.

Here is an example of using that interface in context of node visitor:

TreeNode rootTreeNode = URCapAPIFacade.getURCapAPI().getProgramModel().getRootTreeNode(this);
rootTreeNode.traverse(new ProgramNodeVisitor() {
	public void visit(WaypointNode programNode, int index, int depth) {
		WaypointNodeConfig waypointNodeConfig = programNode.getConfig();
		switch(waypointNodeConfig.getConfigType()) {
			FixedPositionWaypointNodeConfig cfg = (FixedPositionWaypointNodeConfig)waypointNodeConfig;
			if(cfg.getPositionDefinition() == FixedPositionWaypointNodeConfig.PositionDefinition.DEFINED) {
				System.out.println("Fixed position defined pose: " + ((FixedPositionDefinedWaypointNodeConfig)cfg).getPose());

Hi !

I need to read all waypoints in my program and put them in a combobox. When i select a item in combobox i want to read pose data for that waypoint. I don`t know how to use the code above. Can you help me ?

If you want to list the waypoints in a JComboBox, you’ll need to get the name of each waypoint and store in in a String array, ArrayList or similar, then build a JComboBox around that list/model.
See https://docs.oracle.com/javase/tutorial/uiswing/components/combobox.html for how to use a JComboBox.
Use an ItemListener to check for when the selected item is changed and fetch the data for you relevant waypoint.
The API Reference section at the top of this page should help you understand the code in mmi’s post.

Hello, is this what you mean? A waypoint(s) is shown in the expression keyboard when created:

The traverse method above shows that you are able to read the pose of the children of a specific programnode.

I want to read all waypoints generatet in program tree or waypoints generatet from other Urcaps.
But there is something i miss, because i`m not able to do it.

Are you trying to read using this example ?

If not, then how?