# String to pose variable

**URL:** <https://forum.universal-robots.com/t/string-to-pose-variable/4903>\
**Category:** URScript\
**Created:** [August 14, 2019, 12:43am UTC](https://forum.universal-robots.com/t/string-to-pose-variable/4903 "2019-08-14T00:43:01Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![brian.walker](https://avatars.discourse-cdn.com/v4/letter/b/82dd89/32.png) [@brian.walker](https://forum.universal-robots.com/u/brian.walker)\
**Post date:** [August 14, 2019, 12:43am UTC](https://forum.universal-robots.com/t/string-to-pose-variable/4903/1 "2019-08-14T00:43:01Z")

</div>

We are using a PC to set teach points on the UR through a TCP socket. The teach points already defined on the robot.  
We would like to send down the name of the teach point and pose data (p[0,0,0,0,0,0]) through TCP as a string. We parse the string to separate the name and position. Then we want to assign the pose to the name we just sent down.  
For example:  
We send “W1, 1,1,1,2,2,2”  
MyPointName=W1  
MyPose=1,1,1,2,2,2  
MyPointName=MyPose

How can I get this to work. I attached a picture of different things I’ve tried.

 ![Ur%20string](https://us1.discourse-cdn.com/flex020/uploads/universal_robots/original/2X/b/b1e6f075fa1241b700a171b1a08ceeea81be6dd7.png)

Thanks

---

<div class="post-metadata">

**Author:** ![m.birkholz](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.universal-robots.com/m.birkholz/32/7084_2.png) [@m.birkholz](https://forum.universal-robots.com/u/m.birkholz)\
**Post date:** [August 14, 2019, 6:03am UTC](https://forum.universal-robots.com/t/string-to-pose-variable/4903/2 "2019-08-14T06:03:12Z")

</div>

String concatenation in urscript does not work the ‘pythonic’ or java way using the + operator. you have to use str\_cat() to do so 😉  
There are also several other issues. you cant define a variable name with ‘on the fly’ concatenation. Also, if you overrwite the mystring variable on attempt 2 the “W1” is gone.  
Using W1\_p=p[0,0,0,0,0,0] works because you overwrite a auto generated variable name with a cartesian pose.

what should work is sth like:  
def test(x,y,z,rx,ry,rz):  
mypose = p[x,y,z,rx,ry,rz]  
movej(get\_inverse\_kin(mypose),a=1.4, v=1.05)  
end  
But why do you even mix UrScript with polyscope generated waypoints ? you can send the whole stack of script through the socket without even using the programming interface by activating the remote control.
