Home Programming


Left ArrowBack to discussions page
HyubiosHyubios Posts: 5 Apprentice
edited May 18 in Programming
lately I am working on a project in which I wanted to make a connection between UR3 and Balluf vision controler via TCP/IP protocol. On the camera site, the program is waiting for a trigger to make a photo, then analyze the data and create a response with a string value. The controller is configured to connect via TCP/IP, with IP and port 36701, which cannot be changed.
For a UR3 cobot, I set the network on and the same mask as camera. I am using two functions for communication: Socket_open("", 36701, "socket_0") and string=Socket_read_string("socket_0", prefix="(", suffix=")") as the output string are in brackets.
Unfortunatelly, I am not able to receive or send any data from/to UR/camera, and now I do not know what to do. Do I make anything incorrect, or do I miss something?

Does anyone made some projects with Balluff vision / UR cooperation, or do You know what should I do to make this problems be fixed? I would be much obliged for any responses or help :smile: 


Best Answer

  • matthewd92matthewd92 Posts: 1,070 Handy
    Accepted Answer
    Can you send over the exact model of controller you are trying to use?  The only one that I found on a quick search uses UDP for communication, not TCP/IP and has the same port as you reference in your question.  The UR does not support UDP communication. 

    Either way, you will need to send the trigger command to the camera.  Depending on the controller there could be a specific command that needs to be sent or it could be anything that sends data to the port and causes the camera to take the image and then respond with the data.  Generally speaking it looks like this:

    ocket_open("", 36701, "socket_0")
    socket_send_string("trigger", "socket_0")
    string=socket_read_string("socket_0", prefix="(", suffix=")")
    If you are looking for coordinates you should have the camera send over the coordinates as float numbers and then you can use socket_read_ascii_float() instead.


  • HyubiosHyubios Posts: 5 Apprentice
    Hello Matthew,

    I'm trying to use BAE0103 controller (https://www.balluff.com/local/en/productfinder/product/?key=BAE0103#/), which surely is able to connect by TCP/IP, as I was using it to connect with other scara robots, but no UR at all.

  • matthewd92matthewd92 Founding Pro, Tactile Sensor Beta Testers Posts: 1,070 Handy
    edited May 19
    Look in the manual starting on page 76 and it gives the details of what you need to do to get it to trigger an image.  If you send the connect string to the controller you should get a response from the camera.

    I found the manual at https://assets.balluff.com/WebBinary1/MAN_BAE_PD_VS_014_05_EN_K19_DOK_939183_05_000.pdf
  • HyubiosHyubios Posts: 5 Apprentice

    thank You for Your reply. I finally managed to connect with a camera and trigger it, as well as receiving data back to UR cobot :smile: Thank You.

    Now I would like to ask You, how can I send hexadecimal variables from cobot to a camera? The three hex variables I need to use is 01hex, 40hex and 20hex. For 40hex, I can swich it to "@ sign, that specify the trigger data, and it works perfect. But for 01hex (as €") and 20hex (as blank space) I cannot manage to do so. I tried to copy this symbols from some outside program code, but it just doesn't work. I also tried to send it as decimal variables, so "01" and "32". How can I send hex string from a cobot then?

    Another thing is that I'm receiving coordinates data from a camera in a (x, y, r) format. Looking at other topics in this forum, I saw it could be changed to [x, y, r] form to obtain list of variables, so I can get the specific index from the list. I'm trying to save this list to a variable "string" which has "[]" as variable, but now I do not know if socket_read_string("camera") is a proper function to read this data, as well as I do not know what function do I have to use to read the specific index to save as X, Y and R variable. Could You tell me how should the program looks like, to get the three separate variables from one string, (eg. [-123,344,-1337]) and create one point from them?

    Thank You in advance!
  • matthewd92matthewd92 Founding Pro, Tactile Sensor Beta Testers Posts: 1,070 Handy
    edited May 20
    To receive a list of numbers you would need to use socket_read_ascii_float. The first index in that list will be the length of the list received. So you would get [length, x, y, r]. Assign the list received to a variable and then you can access the individual element by using variableName[index] notation. 

    You can also check that the data is valid by checking the length is correct before making assignments. 

    On your hex values try sending "SOH" for 0x01, "SPACE" for 0x20 and see if those work.  I got those values from an Hex to ASCII Chart which you can look at here https://www.bibase.com/ascii.htm.  This chart also shows the character for 0x40 is "@" which you said worked so maybe...
  • HyubiosHyubios Posts: 5 Apprentice
    Unfortunatelly it does not work properly... Except "@" sign, non of the rest work correctly. What is more, I would also need to send some long data, like barcodes, so then the command should look like: 34 00 0D 00 32 34 36 38 32 34 36 38 32 34 36 38 38, in hex, so with that there is also a problem... As far as I saw, there are no hexadecimal formulas avaliable in Polyscope Scripts, right? Or URCaps addons for that?

  • matthewd92matthewd92 Founding Pro, Tactile Sensor Beta Testers Posts: 1,070 Handy
    None that I am aware of. 
  • HyubiosHyubios Posts: 5 Apprentice
    Does anyone know something about any solution of sending hex variables from UR cobot? How could I try to do it, or is there a specific string formula that could help to convert any data to hexadecimal one? I would be much obliged for any help! :)
Sign In or Register to comment.
Left ArrowBack to discussions page