Return a pose via XMLRPC from a Python daemon

Hi, I’m trying to pass a pose from a python daemon to the UR robot program. I want to move to this pose by using the move command in the normal GUI.
So basically, the robot program should look like this:

mypose = mydaemon.get_pose()
movel(mypose)

I can return a list from the get_pose function in Phyton, but unfortunately, this doesn’t seem to be recognized as pose.
So, is there any way to specify in Python, that I want to return a pose (in URScript you would do this by writing p[0,0,0,0,0,0])? This would be the best solution. I tried to initialize the mypose variable with a pose in the initialization section, but then I get a type error when assigning the result from the daemon.

Another option would be to convert the list into a pose in URScript. Is there a nice way to do this? I could do it, by writing:

temp = mydaemon.get_pose()
mypose = p[temp[0], temp[1], temp[2], temp[3], temp[4], temp[5]]
movel(mypose)

But this would be a pretty ugly solution.
Any suggestions would be appreciated!

I believe you need to send a dictionary from python which then gets interpreted by the UR XMLRPC client as the pose data structure. I can’t remember the key names, but they are something simple like x, y, z, rx, ry, rz.

There might be a “list_to_pose” python sample floating around somewhere.

EDIT:
Found it
https://www.universal-robots.com/articles/ur/interface-communication/xml-rpc-communication/

EDIT2:
Might as well just paste it

def listToPose(l):
    assert type(l) is list
    return {'x' : l[0], 'y' : l[1], 'z' : l[2], 'rx' : l[3], 'ry' : l[4], 'rz' : l[5]}
1 Like

This worked perfectly. Unfortunately, I couldn’t find this information in the URCaps Documentation.
Thanks a lot!

1 Like

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.