Can't make communicate the default RTDE Python example with URSim

Good evening,

I’m currently trying to simulate the script on the simulator on the VM that I downloaded from universal-robots.com.
When I run the example script from PyCharm, I get the following error:

Traceback (most recent call last):
File “E:\Universal Robots\Universal Robots\RTDE_Python_Client_Library-main\examples\example_control_loop.py”, line 50, in
con.connect()
File “E:\Universal Robots\Universal Robots\RTDE_Python_Client_Library-main\rtde\rtde.py”, line 98, in connect
self.__sock.connect((self.hostname, self.port))
TimeoutError: timed out

Any idea what could be causing this error and how I could fix it? Sorry to bother you for such silly errors, I just started using these robots at the company I work for.

Best regards,
Pietro

1 Like

Looks like the connection is just timing out, probably meaning you have an IP address or port wrong. Make sure whatever IP you have in your python script matches what’s on the simulated robot. I would think “localhost” would suffice though.

1 Like

Thanks for replying,

this is what I set in the script:

ROBOT_HOST = “localhost”
ROBOT_PORT = 30004

And this is a screenshot of the robot’s settings.

Can you spot some mistakes I made?

Unless you assign it differently somewhere else (or I’m looking at it wrong) the error is being thrown from the call to .connect() and you’re passing self.hostname and self.port to the function. But there you show you’re assigning these values to different variable names (ROBOT_HOST and ROBOT_PORT respectively). Maybe you just need to change the name of the argument you’re passing to the connect() function?

I think the first lead was the correct one,

now the robot sais that “Network is connected” but when I try to ping the robot’s IP address from the cmd on the host PC the ping goes time out.

Could easily be a VM configuration issue too. I suffer from those A LOT. Whether the VM is sharing my host’s IP address or not, yadda yadda. Definitely still sounds like you’re dealing with more “basic” networking issues as opposed to anything code-writing wise. You’re on the right track though. I wouldn’t worry about your python code until you can ping the robot from your PC

1 Like

An interesting fact is that I can ping the host from the VM but I can’t ping the VM from the host

Sounds like the joys of using a VM to me lol

I have a similar problem.

My RTDE is running on a real robot (UR5 CS3) and sending data for 68 seconds. Then it crashes with an error in “rtde.py”

The data transmission is very stable - and so is the crash after the 68 seconds :slight_smile:

Here is a screen dump video with the program and the crash:

/Henning