I wanted to use a Installation node that enable to set/reset some GP registers. I research about this fact and I found that from Installation node you cannot “write” URScript in Runtime because the scriptwriter add the lines at the beggining. Hence, if I cannot use scriptwriter, and neither using the secondary client from Installation node… (cause I send script through socket but it seems to not work…)
How can I manipulate the GP register values through Installation window in Runtime?
Sending to the secondary client should work… have you checked out this example? Are you sure your script syntax is correct?
So when you say at runtime, you want to be able to do this while the main program is running? In that case you could send it at a secondary program like this:
sec prog():
write_output_integer_register(0,1)
end
Yes, I tried to implement this URCap Sample but it seems that doesn’t work…
The method that sends the script is:
// Method Script //
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 "sec" and "end"
String thisCommand = "sec prog():\n "+command+"\n end\n";
// Send command
out.writeBytes(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);
}
}
And this is the command that appears in the terminal.
I don’t see anything immediately wrong with that… did it work with the sample commands before you changed it? Maybe try set_standard_digital_out(0,True). Easy to see the blue light come on in the I/O tab and no chance that it’s something blocking your RTDE connection that way.
When you send the script you create a new, let’s call it, “execution context” without any variables in it. Robot does not retain any variables after the program is stopped.
This would work:
My idea is to take a installation variable defined by the user and use it to create a move. If everytime I send the script it creates a “execution context” like you called, maybe is not possible.
I didn’t find it in documentation, but deducted it from scripts generated by Polyscope. Everything you want to use has to be there. Even direction of gravity. However you might want to wait for confirmation from UR.