Universal Robots Forum

Get jointposition from waypoint in urcap

Hi everyone,

I need to do a move only when certain conditions are met, this is the structure of my URCAP:

image

I traverse the waypoint to get their pose, check the condition, and execute the move only when certain conditions are met.

I followed the example here to get the Pose from a waypoint, and this is the resulting code:

	for ( TreeNode t : tree ) {
		WaypointNode waypoint = (WaypointNode)t.getProgramNode();
		WaypointNodeConfig waypointNodeConfig = waypoint.getConfig();
		
		switch(waypointNodeConfig.getConfigType()) {
			case FIXED_POSITION:
				FixedPositionWaypointNodeConfig cfg = (FixedPositionWaypointNodeConfig)waypointNodeConfig;	
				if(cfg.getPositionDefinition() == FixedPositionWaypointNodeConfig.PositionDefinition.DEFINED) {
					temp =  ((FixedPositionDefinedWaypointNodeConfig)cfg).getPose().toString();
					System.out.println("Fixed position defined pose: " + temp);
					str_waypoints.add(temp);
				}
				break;
			case RELATIVE_POSITION: break;
			case VARIABLE_POSITION: break;
		}
	}

str_waypoints is a arraylist of waypoints, I store the pose of the waypoints there to check the conditions later.

The requirements changed and I also need the joint position to do more check.

From the example from the SDK I know I can implement my own costum button to get the waypoint ( as seen in the ellipse example by using api.getUserInteraction().getUserDefinedRobotPosition), but since I already have the waypoint in a move node, I don’t want to rewrite everything when there is already a panel that do all I want.

Is there any method to get the joint configuration similar to getPose()?

1 Like

Unfortunately it’s not possible. You need to calculate inverse kinematics with calibration corrections to get joint configuration. This is done by controller on runtime.

There is currently no public access to inverse kinematics in controller.

Hi,

Thank you for your response.

What do you mean by “calibration corrections”? Is this the “qnear” mentioned in the manual?

We need to read the waypoint joint configuration exactly because we do not know which “qnear” we should add in the inverse kinematics function in our computations. We do not know a priori the joint configuration chosen by the user, but this information is contained in waypoint structure.

Do you have any advice to solve the problem?

“Calibration corrections” are offsets to the ideal arm DH parameters calculated individually for each robot during production process.
Information about joint configuration is not always part of waypoint.
You can dive deeper into this topic by searching for “calibration” or “dh” on forum.

Our main problem is that we can’t use inverse kinematcs because we don’t know the qnear, we need to get it from the joint position, but to get the joint position we need the inverse kinematics!

In a waypoint I can get the pose like that

WaypointNode waypoint = (WaypointNode)t.getProgramNode();
WaypointNodeConfig waypointNodeConfig = waypoint.getConfig();
FixedPositionWaypointNodeConfig cfg = (FixedPositionWaypointNodeConfig)waypointNodeConfig;	
Pose p =  ((FixedPositionDefinedWaypointNodeConfig)cfg).getPose();

In a similar way we would like to access the joint configurations, i.e:

WaypointNode waypoint = (WaypointNode)t.getProgramNode();
....	
JointPositions j =  waypoint.getJointPositions();

Do you think this feature will be available in future release?

We can’t use

get actual joint positions()

from the urscript api because the robots isn’t in that position when we are trying to access that information

1 Like

I’m having the same problem, for example if I want to update waypoints that use a rotation or 360 degrees on the 6th axis between two points, I always get the exact same point after updating them, since I have no way of knowing that the 2 poses should have different Qnears.

I have found no other way for me to get the QNear without decompressing the URP file, which is really the last thing I would like to do (Also with unsaved programs there might not even be a URP.)
Another feature request would be to just change the config, instead of actually getting everything, then making a new config, it would be much easier in most instances to just take the config and change whatever you would like to, leave the remaining information. That way if you want to update the WP pose, you don’t need to recalculate the QNear unless you want to.