How to set robot program variable at runtime from URcap

Hello,

TASK:
My task is to create a popup window with several input interactions (to make it more easy for the beginning, we can say they are some buttons)

After pushing a specific button, the already running robot program shall receive an information about that. After that, some different part in the robot program has to be executed.

I thought about a variable that is created and overwritten with the help of a urscript code on a button pressed event.

PROBLEM
Via the generateScript function from the installationnode i created a variable, which will be overwritten from the generatescript form the programnodecontribution, whenever a button is pressed. Problem is that the generate Script from the programnodecontribution only will be executed on time after starting or saving the program.

Im pretty new in the URcap universe and i hope you guys can help me :slight_smile:

Hi,

I’m not sure if I understood your question, the generatescript in the program node contribution will execute every time that the program tree passes by the UR Cap node.

Ok, i added several nodes to be sure that the ur cap node is being executed. I also placed a println in the generateScript function (in ProgrammNodeContribution) to see when this function is called. But as is said it will only being executed when i restart the program or when i saved the program.

Is there another way other than the generateScript function to set a variable from URCap and returning it to the robot program while a program is running?

Have you seen the examples included in the SDK?

https://plus.universal-robots.com/download-center/

Cheers