Universal Robots Forum

Get JointPoisitions from waypoint config?

Continuing the discussion from Get jointposition from waypoint in urcap, as I thought we might need to create a topic in the Feature requests also.

Background

  • As a UR+ URCap developer I would like to be able to get the JointPositions of a FixedPositionDefinedWaypointNodeConfig so it can be used for QNear or for AutoMoveJ etc. so that for a transformation of several waypoints, I don’t have to use a single QNear, when they should have separate ones.

An example of how it works now:

  • An operator has a program with approximately a full rotation difference between 2 or more waypoints, let’s say one has -180 and another +180 on one axis. If this would then be transformed, as we do not have the QNear of those waypoints, all of the points will have have the same rotation, depending on the QNear is used. So if we use QNear as current joint positions, it will be different every time, depending on where the robot is, + or - 180.
    If it is a fixed reference point (like a home/safe position) they will always be the same after transforming, but that most likely means that the robot has to rotate back at one of the points, even though it’s supposed to go around and do other things before it turns back.

An example of how we would like it to work:

  • Transformation of the waypoints will keep the full rotation in the program since it’s able to use the previous JointPositions of the waypoint that has been transformed. So the first point will keep having -360 relative to the second point.

Solution suggestion 1:

Example of how it could be

  • In the same way that we can currently get a Pose:
WaypointNode waypoint = (WaypointNode)t.getProgramNode();
WaypointNodeConfig waypointNodeConfig = waypoint.getConfig();
FixedPositionWaypointNodeConfig cfg = (FixedPositionWaypointNodeConfig)waypointNodeConfig;	
Pose p =  ((FixedPositionDefinedWaypointNodeConfig)cfg).getPose();
  • It would be really good in a lot of cases to be able to get the Qnear / JointPositions instead, like:
WaypointNode waypoint = (WaypointNode)t.getProgramNode();
WaypointNodeConfig waypointNodeConfig = waypoint.getConfig();
FixedPositionWaypointNodeConfig cfg = (FixedPositionWaypointNodeConfig)waypointNodeConfig;	
JointPositions p =  ((FixedPositionDefinedWaypointNodeConfig)cfg).getJointPositions();

Solution suggestion 2:

Another option would be to be able to just edit an existing waypoint configuration.

  • So instead of getting all the info, then creating a new one based on those:
WaypointNode waypoint = (WaypointNode)t.getProgramNode();
WaypointNodeConfig waypointNodeConfig = waypoint.getConfig();
FixedPositionWaypointNodeConfig cfg = (FixedPositionWaypointNodeConfig)waypointNodeConfig;	

BlendParameters blend = ((FixedPositionDefinedWaypointNodeConfig) cfg).getBlendParameters();
WaypointMotionParameters motion = ((FixedPositionDefinedWaypointNodeConfig) cfg).getMotionParameters();
Pose p =  ((FixedPositionDefinedWaypointNodeConfig)cfg).getPose();
JointPositions qNear = jointPositionFactory.createJointPositions(0,0,0,0,0,0, Angle.Unit.RAD);

FixedPositionDefinedWaypointNodeConfig newFixedDefinedWPConfig = waypointNodeConfigFactory.createFixedPositionConfig(pose, qNear, blend, motion);
  • One could instead be able to only change the things one would like to:
WaypointNode waypoint = (WaypointNode)t.getProgramNode();
WaypointNodeConfig waypointNodeConfig = waypoint.getConfig();
FixedPositionWaypointNodeConfig cfg = (FixedPositionWaypointNodeConfig)waypointNodeConfig;	

WaypointMotionParameters motion = programAPI.getProgramModel().getProgramNodeFactory().createWaypointNode().getConfigFactory()createJointMotionParameters(jSpeed, jSErrorHandler, jAcceleration, jAErrorHandler)
Pose p =  programAPI.getValueFactoryProvider().getPoseFactory().createPose( x, y, z, rx, ry, rz, Length.Unit.M, Angle.Unit.RAD);

 waypointNodeConfig = waypointNodeConfigFactory.editFixedPositionConfig(waypointNodeConfig, pose);
 waypointNodeConfig = waypointNodeConfigFactory.editFixedPositionConfig(waypointNodeConfig, motion);
  • Alternativly:
 waypointNodeConfig = waypointNodeConfigFactory.editFixedPositionConfig(waypointNodeConfig, pose, null, null, motion);

That way, the JointPositions and BlendParameters stays the same, but Pose and WaypointMotionParameters are changed as needed.


Both solutions work in my opinion, but the first one could be better in the cases where you don’t want to do a transformation, but only want the information of the JointPositions for reasons that I have not written here or even thought of.

3 Likes