Universal Robots+

Getting pose from a TreeNode in Java

Hi,

I have some folders under an “If false” statement, in which the user is supposed to add waypoints, so that he teaches the specific movements (each folder is for one movement). The folder and the respective move nodes are of TreeNode type. You can see the concept in this post, only I don’t have specific names for the waypoints, because I don’t want to force the user to pay attention to it: Accessing Waypoints/Poses in UR Script

I need to get all the waypoints under a specific move node and read their poses, so those can be put into a script function and executed later on when needed. I have a problem both with accessing the waypoint nodes and reading the poses. When it comes to poses I’ve seen the visit function in this discussion: WaypointNode getPose(), but it takes only waypoint arguments, not TreeNodes.

Any advice or code samples are welcome :slight_smile:

Hi,

what you need is to get access to the ProgramNode and then cast the ProgramNode to a Waypoint Node.
for example:

WaypointNode wpNode = (WaypointNode) wpTreeNode.getChildren().get(0).getChildren().get(0).getProgramNode();
FixedPositionDefinedWaypointNodeConfig wpNodeConfig = (FixedPositionDefinedWaypointNodeConfig) wpNode.getConfig();
Pose wpPose = wpNodeConfig.getPose();

will get you the first Waypoint Node Pose of your fist Move Node of your TreeNode.