# Creating a variable in installation node and calling it in programnode urscript

**URL:** <https://forum.universal-robots.com/t/creating-a-variable-in-installation-node-and-calling-it-in-programnode-urscript/4253>\
**Category:** Java\
**Created:** [May 8, 2019, 9:15am UTC](https://forum.universal-robots.com/t/creating-a-variable-in-installation-node-and-calling-it-in-programnode-urscript/4253 "2019-05-08T09:15:09Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![anon94763411](https://avatars.discourse-cdn.com/v4/letter/a/3e96dc/32.png) [@anon94763411](https://forum.universal-robots.com/u/anon94763411)\
**Post date:** [May 8, 2019, 9:15am UTC](https://forum.universal-robots.com/t/creating-a-variable-in-installation-node-and-calling-it-in-programnode-urscript/4253/1 "2019-05-08T09:15:09Z")

</div>

Hello,

I’m writing an URCap which basically should have architecture which is explained below :

**Installation Node-**

1. We are creating a variable which will return (get\_actual\_tcp\_pose). we have to create 3 different variables and store 3 different poses.

**Program Node** -

1. The variables which are created in installation node will be called in programnode **(generateScript(ScriptWriter writer)** … We have to initialise these variables in URscript in program node.

So my problem is,

1. How can we create a variables in installation node which will store the actual tcp pose?
2. We have tried to use **getInstallation(**) which will pass variables from installation node to program node. But we are not able to crack it. Is there any way to pass variables from installation node to program node.
3. How can we pass the variable in program node (generateScript(ScriptWriter writer) to initialize URScript.  
Best Regards,  
Rohan

---

<div class="post-metadata">

**Author:** ![jbm](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.universal-robots.com/jbm/32/614_2.png) [@jbm](https://forum.universal-robots.com/u/jbm)\
**Post date:** [May 8, 2019, 12:21pm UTC](https://forum.universal-robots.com/t/creating-a-variable-in-installation-node-and-calling-it-in-programnode-urscript/4253/2 "2019-05-08T12:21:38Z")

</div>

Is it required to be Variable-type objects?  
Or could a possible approach be to use the “RobotPositionCallback” to get the user defined robot position, and then save these Poses directly in the installation DataModel and passing these to the ProgramNodes using “getInstallation()”.

---

<div class="post-metadata">

**Author:** ![anon94763411](https://avatars.discourse-cdn.com/v4/letter/a/3e96dc/32.png) [@anon94763411](https://forum.universal-robots.com/u/anon94763411)\
**Post date:** [May 9, 2019, 4:45am UTC](https://forum.universal-robots.com/t/creating-a-variable-in-installation-node-and-calling-it-in-programnode-urscript/4253/3 "2019-05-09T04:45:05Z")

</div>

Thanks for your quick response Jacob.  
As per your suggestion we are on correct track.  
Can you please share me a sample example or document related to **RobotPositionCallback**.

---

<div class="post-metadata">

**Author:** ![jbm](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.universal-robots.com/jbm/32/614_2.png) [@jbm](https://forum.universal-robots.com/u/jbm)\
**Post date:** [May 14, 2019, 2:27pm UTC](https://forum.universal-robots.com/t/creating-a-variable-in-installation-node-and-calling-it-in-programnode-urscript/4253/4 "2019-05-14T14:27:21Z")

</div>

Check out the EllipseSwing sample on Github:

> <https://github.com/UniversalRobots/EllipseSwing/blob/dae971b45fa6bd335a5ae1069ea9d1ef72bf5ace/com.ur.urcap.examples.ellipseswing/src/main/java/com/ur/urcap/examples/ellipseswing/EllipseProgramNodeContribution.java#L103-L115>

---

<div class="post-metadata">

**Author:** ![anon94763411](https://avatars.discourse-cdn.com/v4/letter/a/3e96dc/32.png) [@anon94763411](https://forum.universal-robots.com/u/anon94763411)\
**Post date:** [May 14, 2019, 3:23pm UTC](https://forum.universal-robots.com/t/creating-a-variable-in-installation-node-and-calling-it-in-programnode-urscript/4253/5 "2019-05-14T15:23:37Z")

</div>

Thanks Jacob for your kind support.  
We have used same approach and it is working fine.
