Writing and reading variables in URScript ethernet socket

Hey there!
First of all, I’m a total newbie to URScript and ethernet communication, so please be patient with me… :wink:
What i’m trying to, is to connect my UR5e with an incoming goods scanner system.
According to the manufacturer, they provide TCP/IP sockets trough which they can provide me all relevant variables for me.
I have seen this guide: TCP/IP SOCKET COMMUNICATION VIA URSCRIPT, but it didn’t really help me…
In this guide there are only waypoints exchanged, but no variables.
The manufacturer of the scanner said, it will be no problem for them, according to the guideline

Here’s what I’m trying to achieve:

  1. Read out the state of the scanner (MODI_READY=true/false)
  2. If true, run the first part of my UR programm.
  3. Send the command (UR_START=true) via socket to the scanner
  4. The scanner application is scanning the goods
  5. Wait for the feedbackt (MODI_IO=true/flase)
  6. If true, finish the UR program and start again at point 1
    6.1 If false, call a UR sub-program and then go back to point 3

So in the end, I need to read out

  • MODI_READY=true/false
  • MODI_IO=true/false

And I have to send:

  • UR_START=true/false

So if anyone of you can point me into the right direction, or knows where to find a manual, feel free to help me! :wink:
If my explanation isn’t good enough, just tell me what you need to know exactly!

Thanks for any coming help!
Greg

Not sure what specifically you are looking for so this is me shooting from the hip, try looking at this link Barcode Scanner Application Directly to UR

Someone else may have to help answer your specific questions but hope this helps and best of luck!

Try taking a look through the Script Manual here:

If you search for “socket” you will find commands that relate to sending/receiving information over TCP/IP. Sometimes just seeing what commands you have available can provide a good starting point. You’ll need good documentation from the scanner as far as which bytes/bits correspond to the functionality you want (namely the READY bit and the TRIGGER bit), or what they are named.

For example, you will likely need only use socket_open(), socket_get_var(), and socket_close() to achieve what you’re looking for. I believe the IP address should correspond with whatever address you gave the scanner, and the port is arbitrary as long as it’s not already in use by the robot (I’d just use their example of 50000). The socket_name is also arbitrary. You can name it whatever you want, and this is how URScript will find it using the various other commands.

Hi,

I think it would be best to get a basic understanding of how the robot works and how you would use polyscope before attempting to write complex programs. We have free online learning. I would start here :
e-Series e-Learning

Do the Core track and then the Pro track.