Universal Robots Forum

How to store multiple poses?


I need to store multiple positions/poses of the robot to access them later in the program. The number of positions depends on the user input - the query works perfectly.

I thought I could just make a loop and fill each pose into an array but it does not work. I know how to store a pose in a single variable but in my application the user decides how many poses he needs to store.

Can anyone shed some light here?

Thanks and best regards

PS: oh and where can I change my username to anything different than prename.surname?

Two ways that I can think of are sub programs (which cannot be nested I just found out) or the Assignment node. The Assignment node is like an If/Then for process groups and the value can be established either by the operator or by a variable expression generated by the program.

In my programs, I use several different “cases” to skip around the program, and for debugging/setup where I manually select the “case” I want to start at.


Change your name on top right, click the down arrow and select Account Info.



You can create an array/list of poses:

pose_list = [p[0,0,0,0,0,0], p[0,0,1,0,0,0], p[0,0.5,0,0,0,0]]

You can also write one value into an existing array:

pose_list[2] = p[0.3,0,0,0,0,0]

The problem is that you cannot create an empty array with n elements. You can for example parametrize the array creation as:

if n == 1:
  pose_list = [p[0,0,0,0,0,0]]
elif n == 2:
  pose_list = [p[0,0,0,0,0,0], p[0,0,0,0,0,0]]

and so on.


I found one way to nest subprograms that you can see here (apologies for the CB):


thanks for all your replies and the help.
I managed to use a script to generate the array with the needed size, just like your last example with the parametrized array creation.

It works fine, I can store multiple poses into that and move to them, for example in a loop (right after creation that is). My problem now is, that this array seems not to be global…

To be precise, in my example I have a switch-case where:

In “case #1 I let the user decide how many positions he needs. After his input the array with the necessary size is created and the user can teach the positions one after the other.

In “case #2 the user decides to which of the previously stored positions he wants to go but it seems like the array is not accessible from here, even if I declared it to be global during creation.

Any ideas?

1 Like

What is the exact error you get when it tries to access the array? Can you see your array in the “Variables” tab while the program is running?

1 Like

It works now, thanks :slight_smile:

1 Like