Universal Robots Forum

createTCPSelection changing Installation

Hi devs,

my URCap should read a tcp by a given name and set this tcp for use in a MoveJ Node. I’ve modified the code from the ellipseswing sample and used this for configuring a MoveJ Node. So far this works pretty fine. However, everytime the TCPSelection tcpSelection is used, the robot recognizes a changed installation and marks this by a * after the installation name.

//--- Code ---
	
//--- getURCapTCP
private TCP getURCapTCP(String name) {
    Collection<TCP> TCPcollection = tcpModel.getTCPs();
    int TCP_count = TCPcollection.size();
    if(TCP_count > 0){
	    Iterator<TCP> TCP_itr = TCPcollection.iterator();
	    while(TCP_itr.hasNext()){
            TCP thisTCP = TCP_itr.next();
	        String thisDefaultName = thisTCP.getDisplayName();
		    //System.out.println("Found a TCP named "+ thisDefaultName);
		    if(thisDefaultName.equals(name)){
		    	return thisTCP;
  		    }
        }
    }
    return null;
}

private void configureMoveJNode() {
    ProgramAPI programAPI = apiProvider.getProgramAPI();
    ValueFactoryProvider valueFactoryProvider = programAPI.getValueFactoryProvider();
    SimpleValueFactory valueFactory = valueFactoryProvider.getSimpleValueFactory();

	AngularSpeed speed = valueFactory.createAngularSpeed(80.0, AngularSpeed.Unit.DEG_S);
	AngularAcceleration acceleration = valueFactory.createAngularAcceleration(120.0, AngularAcceleration.Unit.DEG_S2);
	TCP tcp = getURCapTCP("URCap");
	TCPSelection tcpSelection = moveNode.getTCPSelectionFactory().createTCPSelection(tcp);
	TCPSelection tcpSelectionTest = moveNode.getTCPSelectionFactory().createActiveTCPSelection();
	
    MoveJConfigBuilder moveJConfigBuilder = moveNode.getConfigBuilders().createMoveJConfigBuilder()
    		.setJointAcceleration(acceleration, ErrorHandler.AUTO_CORRECT)
    		.setJointSpeed(speed, ErrorHandler.AUTO_CORRECT)
    		.setTCPSelection(tcpSelection);
    
	moveNode.setConfig(moveJConfigBuilder.build());
}

Anything i can do against this behaviour?

Regards
Andreas