I modified the HelloWorld Program Contribution as bellow
but I have always an Error:
HelloworldProgamNodeContribution is not abstract and does not override abstract method generateScript(ScriptWriter) in ProgramNode Contribution
package com.ur.urcap.examples.helloworld.impl ;
// API stuff imported
import com.ur.urcap.api .contribution.ProgramNodeContribution ;
import com.ur.urcap.api.domain.URCapAPI ;
import com.ur.urcap.api.domain.data.DataModel ;
import com.ur.urcap.api.domain.script.ScriptWriter ;
import com.ur.urcap.api.ui.annotation.Input ;
import com.ur.urcap.api.ui.annotation.Label ;
import com.ur.urcap.api.ui.component.InputEvent ;
import com.ur.urcap.api.ui.component.InputTextField ;
import com.ur.urcap.api.ui.component.LabelComponent ;// Used for reading from RealTime Client
import java.io.DataOutputStream;
import java.io.IOException;
import java.net.Socket;public class HelloWorldProgramNodeContribution implements ProgramNodeContribution {
private final URCapAPI urCapAPI; private final DataModel dataModel;
public HelloWorldProgramNodeContribution(URCapAPI urCapAPI, DataModel dataModel) {
this.urCapAPI = urCapAPI;
this.dataModel = dataModel;
}
// Include the “clientSendScript” class as “scriptSender”
//clientSendScript scriptSender = new clientSendScript();// Just a pose, that is used for moving the robot…
private String myPose = “p[0.0,-0.3,0.1,0,3.1415,0]”;public class clientSendScript {
public clientSendScript() { }
// localhost IP
private String TCP_IP = “127.0.0.1”;
// Port for secondary client
private int TCP_port = 30002;// Public method to send MoveJ command to client interface
public void sendMoveJ(String pose){
sendToSecondary(“movej(”+myPose+“,a=1.57,v=0.5)”);
}// Internal method that sends script to client
private void sendToSecondary(String command){
try{
// Create a new Socket Client
Socket sc = new Socket(TCP_IP, TCP_port);
if (sc.isConnected()){
System.out.println(“Connected to UR Secondary Client”);
}// Create stream for data DataOutputStream out; out = new DataOutputStream(sc.getOutputStream()); // Wrap command in "def" and "end" String thisCommand = "def myCustomCode():\n "+command+"\n end\n"; // Send command out.writeUTF(thisCommand); System.out.println("Send this: "+thisCommand); out.flush(); // Perform housekeeping out.close(); sc.close(); System.out.println("Disconnected from UR Secondary Client"); } catch (IOException e){ System.out.println(e); }
}
}}
thank you in advance