Universal Robots Forum

Variable passthrough from program- to installation- Node

Hello,

I’m writing an URCap which basically should be some kind of hardware driver and obtain 2 nodes as followed:

InstallatioNode:

  • providing some basically adjustment for the hardware
  • all settings here are globally and just related to the hardware not the program it’s function is required

ProgramNode:

  • providing the individual configuration which depents on the special Program it runs in.

So my problem is that, i had one configuration variable in my ProgramNode which should be individual depending on the program so i’d like to the it in ProgramNode instead of Installation Node but is needs to write an writer line in the Preamble of the Program.
In that case ist basically a field where you can configure a default value which should be applied at program start…

My question is: is there a way to give the programnode the opportunity to write code into the preamble or maybe a way to access functions from the programnode within the installation node to write the code there?

Best regards, Mathias

You can use the getInstallation() method as implemented e.g. in the HelloWorld sample.
This returns the InstallationNodeContribution object to the program node, and can be used then to call some public method in the installation node.
Hence, this could be used tho set this value from the Program Node, so the Installation Node performs this setting in its ScriptWriter.

Oh well i didn’t see the tree infront of the valley :smiley:

Didn’t realised for this point that i can as well access some set() functions.
Had onyl worked with get() functions beforde…

Thanks for youre quick response :+1: