Robot comunicating with PC

Hello,

I am doing a project where I have to use a UR10e to do defects inspection with a camera. I am new with the robot programming, so my problem is how to conect the robot to a PC.

What I have at this moment is a python code where it opens a camera (in this case a basler ace aca1300-30gm), calls a yolov5 model to detect the defects and saves the image.

What I want is: the robot moves to a destination_point, when it reaches this points it sends a signal to PC to run the python code and then returns to first position. I am doing the robot program using the teach pendent.

Any help would be appreciated :slight_smile:

Hi Diogo…

There are multiple methods to accomplice this, please look up

Primary Interface
Secondary Interface
Interpreter_mode

each of these if used correctly could do the job.

using ROS would properly be a very common way of combining all of this into one coherent system.

Best Regards CG1

1 Like

What you are looking for is xmlrpc.

see here:

https://www.universal-robots.com/articles/ur/interface-communication/xml-rpc-communication/

there is a python example w/ camera setup just like you describe in the links at the bottom

1 Like

Thank you @roguebuck

I followed that example, where I put in the polyscope program the IP of my computer. However, it gives me an error like it’s shown bellow.


Would you know how to solve this?

PS: I connected the PC and robot controller directly with an ethernet cable.

You should not connect the robot and the PC directly with an ethernet cable.
They dont simply need to be connected. They need to be on the same network. Plugging the robot into the PC will not automatically give the robot a valid IP-address.

Instead, get a router and plug both your pc and the robot into the router.
The router will give your pc and the robot an IP address, making it possible for them to communicate.

1 Like

Thank you @robin_gdwl :slight_smile:

This means that the code in the UR cannot reach the XML-RPC server on your computer side.

  • Check that both the PC and UR have valid IP addresses, and that the UR has the correct PC server address and port.
  • Run the ping $IP_ADDR on both ends to verify that they can reach each other.
  • On the PC side, check if Windows Firewall is blocking the connection.

Thank you @cags I did what you told and it worked!! (The windows firewall was indeed blocking the connection :roll_eyes: )

Here are some resources I’ve drafted in the past loosely related to communications

Introduction to primary client interface

URScript Socket example

Moving the UR3e with ROS2 driver

1 Like

Thank you @smarmstr :slight_smile:

Re: image #1: what did you specify in urscript as your xmlrpc server? in my experience, you have to explicitly specify “http://{serverIP}:{serverPort}/” in the address. Double check. the “/” is important, too, depending on how the server is setup.

Re:Image #2: it looks like your rtde loop is not petting the watchdog. you either need to add that to your rtde config on the server end (and set it each loop) or remove it from your robot program