Universal Robots Forum

Define Waypoint without User Interaction by taking the current pose

Hello there!

I am stuck with a problem. I am trying to modify the URCaps Starter Package Sample ellipse. Currently the program asks the user for the waypoint: the user has to define the waypoint and press ‘ok’.
Now I want to skip the User Interaction and take the current robot pose and joint positions for the waypoint. That means: after pressing the button ‘select centerpoint’ the program should take the current pose as the centerpoint and have directly the fully defined waypoints without user interaction.

If I simply delete the ‘getUserDefinesRobotPosition’ line and the ‘onOk’ line, the program asks for pose and jointPositions.
I tried it with datamodel.get like you can see below, but the program then asks for a ‘key’ and ‘defaultValue’.
Hope you can help me. Thank you in advance.

Here is my current program:

private void selectCenterPoint() {
urCapAPI.getUserInteraction().getUserDefinedRobotPosition(new RobotPositionCallback() {

  	@Override
  public void onOk(Pose pose, JointPositions jointPositions) {

  removeNodes();
  		createNodes();
  		configureMoveNode();
  		
  	//	Pose pose = dataModel.get(key, defaultValue);
  	//	JointPositions jointPositions = dataModel.get(key, defaultValue);

  		adjustWaypointsToCenterPoint(pose, jointPositions);
  	}

});
}

I was trying to do something similar and the closest I got was to try and use the client interfaces to connect to the robot and read the positions. I wasn’t well versed in it, so I tried sample here https://forum.universal-robots.com/t/sample-getrobotdata-real-time-client-reader-urcap/1195/4 . Unfortunately I couldn’t get it working, but you might have more luck than me.

1 Like

Thank you for your help!
I worked with the sample and it works. But taking the current postion as a centerpoint for the ellipse (Sample Ellipse) does not work yet. When I press the button ‘Set centerpoint’ then a move node appears with one unconfigured Waypoint.
The message in the Linux Terminal is the following:

ERROR [AWT-EventQueue-1] 12:27:42 29/05/18 HMC.receiveJointPositionVector(line550): Inverse kinematics failed, no solution found.
ERROR [RobotState - PostMan] 12:27:42 29/05/18 RobotState$PostMan.work(line:257): RobotState messages are queued up: 3

Here is my code…hope someone can help:

private void selectCenterPoint() {
{

  Unit unit1 = Length.Unit.MM;
  double[] tcp = new double[266];	
  tcp = getData.getActualTcpPose();
  double[] jts = new double[266];
  jts = getData.getActualJointPose();
  
  removeNodes();
  		createNodes();
  		configureMoveNode();

Pose pose = urCapAPI.getValueFactoryProvider().getPoseFactory().createPose(tcp[0], tcp[1], tcp[2],
tcp[3], tcp[4], tcp[5], unit1, Angle.Unit.RAD);

JointPositions jointPositions = urCapAPI.getValueFactoryProvider().getJointPositionFactory().createJointPositions(jts[0], jts[1], jts[2], jts[3],
jts[4], jts[5], Angle.Unit.RAD);

  		adjustWaypointsToCenterPoint(pose, jointPositions);
  	}

I solved the problem on my own. It was a simple unit failure. the correct line is:

Unit unit1 = Length.Unit.M;

So now my problem is solved. I can simply press the button and set the waypoint without any more user interaction.

Thank you stefanhe99 :slight_smile:

Don’t hesitate to ask any questions about this topic.

1 Like

What is the use case here?
If commercializing the URCap, I would encourage using the “RobotPositionCallback”, as this is the same type of behavior, the user experiences in other parts of PolyScope.
When we certify URCaps for UR+, we take note that the behavior of the URCap is consistent with the remaining PolyScope. And by using the RobotPositionCallback, navigating the user to the Move screen to tdefine the position, the user gets a bit more tools to adjust to the correct pose.

I encounter the similar situation, my application let user set a waypoint by free drive and than press a button to create the way point and by pass the system set way point