Controlling UR3 through Computer

Hi, first of all, sorry if this is a newbie problem, but I’ve researched for quite a few days and found no working solution

I am having a hard time establishing an Ethernet/IP connection between my UR3 and my computer, I am just using an Ethernet cable to directly connect the PC and the UR3.

My objective is to use this connection to send commands through to the UR3 and also to read data from the robot. I am planning to do this on python. I have tried to follow severel guides but to no avail, I am pretty sure that the mistakes I am making are when defining the adresses in the UR3.

I always tried to establish the connection with my Wi-Fi off as it was told in many articles. I don’t know if it helps but when I connect the Ethernet cable a not identified network would appear in my computer with the IP 192.168.73.50 (is that supossed to be my DNS server?)

The last setup I tried is the suggested in this guide, I know it is a guide meant for the UR3e but I am up to trying anything at this point really.

imagem_2021-12-21_174605

The code I am using (in python) to test the connection is as follows:

import socket
import time

HOST = "192.168.1.100"
PORT = 30002

s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)

s.connect((HOST, PORT))

s.send(("set_digital_out(1,True)" + "\n").encode('utf8'))

time.sleep(2)

s.send(("movej([0, 0, 0, 0, 0, 0, a=1, v=1])" + "\n").encode('utf8'))

s.close()

I really am not well versed in networks so I don’t really know what adresses I need to change to work with my project or if I need to do something on my PC. I did verify that the IP of the UR3 is set to the one that’s in the image, but I don’t know if I am supposed to use the same subnet mask/gateway/DNS server. Thank you for reading

So all you should need to do is set the IP and the subnet mask–don’t need DNS or gateway unless the robot is leaving the LAN. Can just leave them as 0.0.0.0

just make sure you’re on the same subnet 192.168.1.x (aka make sure your computer has a static IP set)

Eg:
robot: 192.168.1.100
your network adapter: 192.168.1.10

test if you can contact the robot from your computer with:

ping 192.168.1.100

Usually this will work no problem. Going the other way (robot talking to computer) can be trickier as you’ll probably have to open a port in windows firewall.

1 Like

Ok, thank you very much, I will try that first thing in the morning. On another note, do I need to activate any mode on the UR3’s console? I saw in UR3e’s guides that you need to activate the remote control before starting any connection. Is there a similar procedure for the UR3?

Yea here’s a link:

In e-Series, there are remote and local modes. When the robot is in the local mode, it is not allowed to receive URScript commands and the connection to the ports 30001, 30002, and 30003 will be lost. If you need to monitor the robot state both in remote and local modes, you should use the ports 30004, 30011, 30012, and 30013.

Just one more question before I head into experimenting tomorrow, should I keep using the secondary port (30002) in order to send commands? Or is one of the other ones more appropriate?

I managed to make it work with your instructions. I just had to setup a random DNS and gateway on PC too. Thank you, you really saved my skin, now I am able to use thtis mini Winter Holidays to work on this project

1 Like

Hey terry c, i know you mentioned robot to PC is more complicated how does this differ

It really depends on the OS you’re going to be talking to. Linux is fine–can’t vouce for mac. Windows takes some extra steps.

Let’s say I want to run an XMLRPC server on my windows laptop (192.168.0.10, port eg 40404) and I want the robot to connect and call a function.

On the robot we’d have something like:

client = rpc_factory("xmlrpc", "http://192.168.0.10:40404")
a = client.myFunction()

Windows firewall will usually reject the incoming http request and so now I’d have to go into the firewall and create a rule for incoming TCP port 40404 to allow the connection coming from the robot.