# NodeContribution does not implement the generateScript()

**URL:** <https://forum.universal-robots.com/t/nodecontribution-does-not-implement-the-generatescript/1280>\
**Category:** URCap Development\
**Tags:** generate-script\
**Created:** [October 27, 2017, 12:30pm UTC](https://forum.universal-robots.com/t/nodecontribution-does-not-implement-the-generatescript/1280 "2017-10-27T12:30:04Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![anon4621714](https://avatars.discourse-cdn.com/v4/letter/a/8e8cbc/32.png) [@anon4621714](https://forum.universal-robots.com/u/anon4621714)\
**Post date:** [October 27, 2017, 12:30pm UTC](https://forum.universal-robots.com/t/nodecontribution-does-not-implement-the-generatescript/1280/1 "2017-10-27T12:30:04Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![anon36839296](https://avatars.discourse-cdn.com/v4/letter/a/b2d939/32.png) [@anon36839296](https://forum.universal-robots.com/u/anon36839296)\
**Post date:** [May 15, 2020, 8:54am UTC](https://forum.universal-robots.com/t/nodecontribution-does-not-implement-the-generatescript/1280/2 "2020-05-15T08:54:29Z")

</div>

> [@anon4621714](#):
>
> Perform

Hi,

I follow this code to send movej but I also would like some event for the next step after the robot already moved to the target position successful.

could you please give me an advice.

---

<div class="post-metadata">

**Author:** ![anon77695744](https://avatars.discourse-cdn.com/v4/letter/a/a698b9/32.png) [@anon77695744](https://forum.universal-robots.com/u/anon77695744)\
**Post date:** [May 17, 2020, 12:58am UTC](https://forum.universal-robots.com/t/nodecontribution-does-not-implement-the-generatescript/1280/3 "2020-05-17T00:58:25Z")

</div>

It seems as if your NodeContribution does not implement the generateScript() function the ProgramNodeContribution interface demands.  
Just add the following lines and your error should disappear:

```
@Override
public void generateScript(ScriptWriter writer){}

```

The interface needs some more functions to be defined. Probably best if you have a look into one of the example URCaps or the definition of the ProgramNodeContribution interface.

---

<div class="post-metadata">

**Author:** ![anon48013246](https://avatars.discourse-cdn.com/v4/letter/a/ba8739/32.png) [@anon48013246](https://forum.universal-robots.com/u/anon48013246)\
**Post date:** [July 2, 2020, 10:40am UTC](https://forum.universal-robots.com/t/nodecontribution-does-not-implement-the-generatescript/1280/4 "2020-07-02T10:40:22Z")

</div>

Hi,

I follow this code and it work very well. but I can see that move respect to base coordination, I wonder how to change it to move the robot respect to Tool coordination.

> [@anon4621714](#):
>
> // Public method to send MoveJ command to client interface  
> public void sendMoveJ(String pose){  
> sendToSecondary(“movej(”+myPose+“,a=1.57,v=0.5)”);  
> }

normally, I move the robot with URscript as below but now I would like to move as the same via URCap

**Example code:**

global pose\_wrt\_tool = p[0,0,0.1,0,0 , 1.57]

global pose\_wrt\_base = pose\_trans(get\_forward\_kin(), pose\_wrt\_tool)

movel( pose\_wrt\_base , a=1.2, v=0.25)

```
   get_forward_kin() returns current pose.

```

---

<div class="post-metadata">

**Author:** ![Savoia](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.universal-robots.com/savoia/32/4844_2.png) [@Savoia](https://forum.universal-robots.com/u/Savoia)\
**Post date:** [January 27, 2021, 12:27am UTC](https://forum.universal-robots.com/t/nodecontribution-does-not-implement-the-generatescript/1280/5 "2021-01-27T00:27:08Z")

</div>

Closed on January 27, 2021, 12:27am UTC


