Universal Robots Forum

Program node does not generate it's script until clicked

Hello everybody,
we are developing an URCAP for UR robots. It is working fine.
Only issue is when we load a program that uses our Program nodes. They do not seem to append their script (generateScript()) until the node has been clicked by the user.
So when ‘PLAY’ is pressed, the Robot simply skips our function nodes, like everything is fine.
We checked the script generated, and our nodes’ code was missing.
This was experienced in an e-series UR3, polyscope 5.1.

Briefly: When the program is being written it works fine. When the program is loaded from USB or robot Memory, the URCAP’s nodes are skipped during execution. The workaround is to click each node individually, and only then press ‘PLAY’.
Did anyone ever had the same problem?

Here is a snippet of our Program Node Contribution:

public void openView() {
System.out.println(“openView of Gripper program node”);
view.setSelectedValueComboBox(model.get(FUNCAO_KEY, FUNCAO_DEFAULT_VALUE));
view.setApertureTextField(model.get(ABERTURA_KEY, ABERTURA_DEFAULT_VALUE));

public void closeView() {

public String getTitle() {
return "Garra GSP80: " + model.get(FUNCAO_KEY, FUNCAO_DEFAULT_VALUE);

public boolean isDefined() {
return true;

public void generateScript(ScriptWriter writer) {
double abertura = model.get(ABERTURA_KEY, ABERTURA_DEFAULT_VALUE);
int ab = (int) (abertura * 100);
int ab1 = (ab >> 8) & 0xFF;
int ab2 = ab & 0xFF;

  String funcao = model.get(FUNCAO_KEY, FUNCAO_DEFAULT_VALUE);
  if (funcao == "Abrir") {
  	writer.appendLine("script_command(COD_open, " + ab1 + "," + ab2 + ")");
  } else if (funcao == "Fechar") {
  	writer.appendLine("script_command(COD_close, " + ab1 + "," + ab2 + ")");


If that’s your entire contribution class, i would have thought the reason for the script not being generated is perhaps because the program can’t reach the 2 writer.appendLine() calls.
What is the value of FUNCAO_DEFAULT_VALUE? if that is neither "Abrir or Fechar then the logic commands will mean the program skip past the 2 script lines as the value with key FUNCAO_KEY hasn’t been set yet, and so defaults to the default value you pass when calling it in generateScript().

Hope this helps.


Also, beware of using simple “==” for equals on value objects in Java.
Consider using “equals” when working with value objects (non primitives).


funcao == "Abrir"

Thank you guys. Program really was skipping the 2 writer.appendLine() calls.
That is because I used == instead of String.equals(), like @jbm said.
Problem solved.


A good tip for checking if a program has reached a certain line is to put a System.out.println(String myString) next to the code you need to test to see if the program passes it. If you have run a simulation of the robot from a terminal, you will see your string printed to the terminal when the program passes the line.
You can also have it output variables and other objects to help you track processes etc.

1 Like