# URScript: Persistent or static variables that retain their values after stopping and starting the robot program or even after rebooting the robot?

**URL:** <https://forum.universal-robots.com/t/urscript-persistent-or-static-variables-that-retain-their-values-after-stopping-and-starting-the-robot-program-or-even-after-rebooting-the-robot/16017>\
**Category:** URScript\
**Created:** [August 20, 2021, 12:28pm UTC](https://forum.universal-robots.com/t/urscript-persistent-or-static-variables-that-retain-their-values-after-stopping-and-starting-the-robot-program-or-even-after-rebooting-the-robot/16017 "2021-08-20T12:28:47Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![k.berdel](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.universal-robots.com/k.berdel/32/2465_2.png) [@k.berdel](https://forum.universal-robots.com/u/k.berdel)\
**Post date:** [August 20, 2021, 12:28pm UTC](https://forum.universal-robots.com/t/urscript-persistent-or-static-variables-that-retain-their-values-after-stopping-and-starting-the-robot-program-or-even-after-rebooting-the-robot/16017/1 "2021-08-20T12:28:47Z")

</div>

Hi,

Is there a way to create persistent or static variables that retain their values after stopping and starting the robot program or even after rebooting the robot with URScript?

I’d like to set a pose feature to a certain value and would like to remember that value, even if the robot program stops.

Thank you in advance for your help and best regards

Klaus

---

<div class="post-metadata">

**Author:** ![Ebbe](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.universal-robots.com/ebbe/32/1413_2.png) [@Ebbe](https://forum.universal-robots.com/u/Ebbe)\
**Post date:** [August 20, 2021, 1:25pm UTC](https://forum.universal-robots.com/t/urscript-persistent-or-static-variables-that-retain-their-values-after-stopping-and-starting-the-robot-program-or-even-after-rebooting-the-robot/16017/2 "2021-08-20T13:25:42Z")

</div>

Hi @k.berdel,

That is not possible. With the URCap API it is possible to register a feature that will persisted in the installation file.

Ebbe

---

<div class="post-metadata">

**Author:** ![k.berdel](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.universal-robots.com/k.berdel/32/2465_2.png) [@k.berdel](https://forum.universal-robots.com/u/k.berdel)\
**Post date:** [August 20, 2021, 4:28pm UTC](https://forum.universal-robots.com/t/urscript-persistent-or-static-variables-that-retain-their-values-after-stopping-and-starting-the-robot-program-or-even-after-rebooting-the-robot/16017/3 "2021-08-20T16:28:53Z")

</div>

Hi Ebbe,  
thank you for the quick response.  
If you like, you can move this post to the Wishlist 😉

Best regards  
Klaus

---

<div class="post-metadata">

**Author:** ![mbush](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.universal-robots.com/mbush/32/76_2.png) [@mbush](https://forum.universal-robots.com/u/mbush)\
**Post date:** [August 20, 2021, 5:01pm UTC](https://forum.universal-robots.com/t/urscript-persistent-or-static-variables-that-retain-their-values-after-stopping-and-starting-the-robot-program-or-even-after-rebooting-the-robot/16017/4 "2021-08-20T17:01:37Z")

</div>

If you can create an installation variable in the installation file, it is possible to reference this variable from URScript and set the value. These are persisted between runs and even power cycle. It’s just not possible to create this from URScript, has to be done from the installation file.

---

<div class="post-metadata">

**Author:** ![k.berdel](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.universal-robots.com/k.berdel/32/2465_2.png) [@k.berdel](https://forum.universal-robots.com/u/k.berdel)\
**Post date:** [August 20, 2021, 5:03pm UTC](https://forum.universal-robots.com/t/urscript-persistent-or-static-variables-that-retain-their-values-after-stopping-and-starting-the-robot-program-or-even-after-rebooting-the-robot/16017/5 "2021-08-20T17:03:10Z")

</div>

Thank you, that is a good point.

But I believe in CB-series, they can only be taught, not set to a certain value, e.g p[0,0,0,0,0] (at least i am too stupid to do that). e-series seems more flexible here.

---

<div class="post-metadata">

**Author:** ![mbush](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.universal-robots.com/mbush/32/76_2.png) [@mbush](https://forum.universal-robots.com/u/mbush)\
**Post date:** [August 20, 2021, 9:06pm UTC](https://forum.universal-robots.com/t/urscript-persistent-or-static-variables-that-retain-their-values-after-stopping-and-starting-the-robot-program-or-even-after-rebooting-the-robot/16017/6 "2021-08-20T21:06:21Z")

</div>

Installation variables work the same with CB3, we’ve deployed a lot of them and set installation variables via IRScript. There’s actually no way of “teaching” an installation variable, has to be created on the installation screen. Now depending on the age of Polyscope installed you might have limited types available but we store poses, strings, lists and numbers in them in production robots.

---

<div class="post-metadata">

**Author:** ![bba](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.universal-robots.com/bba/32/555_2.png) [@bba](https://forum.universal-robots.com/u/bba)\
**Post date:** [September 2, 2021, 1:49am UTC](https://forum.universal-robots.com/t/urscript-persistent-or-static-variables-that-retain-their-values-after-stopping-and-starting-the-robot-program-or-even-after-rebooting-the-robot/16017/7 "2021-09-02T01:49:06Z")

</div>

Try creating an installation variable called i\_p1 =p[0,0,0,0,0,0]. Then, in your program go to whatever pose you want to and after arriving at that pose use an assignment to assign current pose to i\_p1 (i\_p1 = get\_actual\_tcp\_pose()) Now stop program. This value should be stored in the installation variables file within i\_p1. Polyscope does this for you but there is no way to force this directly from URscript alone.
