Defining a large array in Installation Variables

I need to record and save dozens of poses during a dry run of a program (to discretize a very irregular motion). 300 poses at least. Then, I need the robot to remember them through power cycles.

In order to do that I defined an array in installation, saved the installation file, unpacked .variables gzip, edited the array to consist of 15 empty poses, saved it to array.variables as a gzip type using 7zip, overwrote the original .variables file, opened installation in URSim.

The array does indeed show 15 x p[0,0,0,0,0,0] elements. Problem is, I can’t overwrite them with new poses.

The other solution I’ve considered is creating a pm2 python server that holds a socket open for listening for a Profinet output but I really think this should not be required for this simple task.

Please help me overcome this, closest topic I’ve found was here: Array/list as installation variable?

I’ve had to solve a similar problem before and ended up with two different work arounds. Both were not ideal, but they did solve the problem.

The first way was to use the installation variables. If I recall correctly, variables cannot be resized (though a program) after being created, so I had to type out two empty pose array variables (50 positions in each variable) before assigning values individually in the program. This was painful and involved a lot of typing (I recommend attaching a usb keyboard to the UR pendant, which might allow copy/paste short cuts). Never tried editing the installation file on a computer, so can’t help you there.

Disclaimer: an installation variable can only hold ~55 poses, so you will need to set up at least 6 installation variables for your application. Saving more than 56 positions in an array (as an installation variable)

The second solution was to set up a python script that the robot could call for positions. (A camera was sending more positions than the UR could handle). I would recommend this if you already have a computer connected for this application. This also does let you edit waypoints much easier than on the UR interface, but I’m not sure it’s worth setting up a computer solely for this purpose.

Here’s a place where I’ve found ChatGPT to be helpful - doing the tedious typing for things where a pattern can be described.

Here’s a fairly straightforward array definition that I had ChatGPT create to put in a UR script:

global sizes_array = [[0.0, 0], [0.5, 1], [1.0, 2], [1.5, 3], [2.0, 4], [2.5, 5], [3.0, 6], [3.5, 7],[4.0, 8], [4.5, 9], [5.0, 10], [5.5, 11], [6.0, 12], [6.5, 13], [7.0, 14],[7.5, 15], [8.0, 16], [8.5, 17], [9.0, 18], [9.5, 19], [10.0, 20],[10.5, 21],[11.0, 22], [11.5, 23], [12.0, 24], [12.5, 25]]

In this case I gave it a basic request to “create a 26-item, 2-dimensional URScript array called sizes_array in which the first value in each item starts at zero and increases by 0.5. The second value is an integer which starts at zero and increases by 1.”

You do have to double check what it gives you - it often tries to use python syntax which isn’t supported by URScript, and sometimes just goes completely wonky.