Sending the value of a variable through a string command

I am trying to automate a calibration program between my UR5e and my Vision controller.
The vision controller URcap has a function that acts similar to a send_socket_string command. I basically need to send my current x and current Y position of the robot to the vision controller through a string.

My function looks like this:
Actual_pose=get_actual_tcp_pose
X=Actual_pose[0]
Y=Actual_pose[1]
EYERawCommand(“set_calibration_point 1 X Y”) The X and Y being my actual robot coordinates.

How do i take the raw data from the X and Y and insert it into my string?

I have tried using the str_cat() function but I haven’t had any success at this point.

Thanks,

Try to_string URscript function:

to_str()

Example:


StringWithVariables := “Hello “ + to_str(4.0) + “ world!”

Hope that helps and best of luck!

I guess I just didn’t use enough Str_cat the first time i tried. Here is what ended up working:

actual_pose=get_actual_tcp_pose Get actual position
X=actual_pose[0] Store X value in Variable
Y=actual_pose[1] Store Y value in Variable
Xstring=str_cat(" “, X) make X value a string and use delimiters necessary to match your vision controller requirements
Ystring=str_cat(” ", Y) make Y value a string and use delimiters necessary to match your vision controller requirements
XYstring=str_cat(Xstring,Ystring) Combine X and Y into one string
Fullstring=str_cat(“set_calibration_point 1”,XYstring) Combine the desired string command with your XY string
EYERawCommand(Fullstring) This should match exactly what your vision controller requires

My end result that is received on the vision controller needed to be [set_calibration_point n x y]
and my result was “set_calibration_point 1 210.320151 -564.097291”

This is a huge mess just to be able to send the absolute value of a variable through socket. hopefully they make a way to just use the absolute value of a variable.