# Robot comunicating with PC

**URL:** <https://forum.universal-robots.com/t/robot-comunicating-with-pc/30610>\
**Category:** Technical Questions\
**Created:** [September 26, 2023, 2:48pm UTC](https://forum.universal-robots.com/t/robot-comunicating-with-pc/30610 "2023-09-26T14:48:12Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![diogo.ferreira](https://avatars.discourse-cdn.com/v4/letter/d/4af34b/32.png) [@diogo.ferreira](https://forum.universal-robots.com/u/diogo.ferreira)\
**Post date:** [September 26, 2023, 2:48pm UTC](https://forum.universal-robots.com/t/robot-comunicating-with-pc/30610/1 "2023-09-26T14:48:13Z")

</div>

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 🙂

---

<div class="post-metadata">

**Author:** ![cg1](https://avatars.discourse-cdn.com/v4/letter/c/c77e96/32.png) [@cg1](https://forum.universal-robots.com/u/cg1)\
**Post date:** [September 28, 2023, 2:32pm UTC](https://forum.universal-robots.com/t/robot-comunicating-with-pc/30610/2 "2023-09-28T14:32:42Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![roguebuck](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.universal-robots.com/roguebuck/32/4848_2.png) [@roguebuck](https://forum.universal-robots.com/u/roguebuck)\
**Post date:** [September 28, 2023, 7:10pm UTC](https://forum.universal-robots.com/t/robot-comunicating-with-pc/30610/3 "2023-09-28T19:10:35Z")

</div>

What you are looking for is xmlrpc.

see here:

[https://www.universal-robots.com/articles/ur/interface-communication/xml-rpc-communication/](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

---

<div class="post-metadata">

**Author:** ![diogo.ferreira](https://avatars.discourse-cdn.com/v4/letter/d/4af34b/32.png) [@diogo.ferreira](https://forum.universal-robots.com/u/diogo.ferreira)\
**Post date:** [October 4, 2023, 12:33pm UTC](https://forum.universal-robots.com/t/robot-comunicating-with-pc/30610/4 "2023-10-04T12:33:30Z")

</div>

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.

 ![MicrosoftTeams-image (1)](https://us1.discourse-cdn.com/flex020/uploads/universal_robots/original/2X/5/5e8adce14f0befaf373cbd035a6f844045950581.jpeg)  
 ![MicrosoftTeams-image](https://us1.discourse-cdn.com/flex020/uploads/universal_robots/original/2X/f/f5c729176de41de31e88e9e77817e577bc92441a.jpeg)

Would you know how to solve this?

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

---

<div class="post-metadata">

**Author:** ![robin\_gdwl](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.universal-robots.com/robin_gdwl/32/2676_2.png) [@robin\_gdwl](https://forum.universal-robots.com/u/robin_gdwl)\
**Post date:** [October 4, 2023, 4:18pm UTC](https://forum.universal-robots.com/t/robot-comunicating-with-pc/30610/5 "2023-10-04T16:18:12Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![diogo.ferreira](https://avatars.discourse-cdn.com/v4/letter/d/4af34b/32.png) [@diogo.ferreira](https://forum.universal-robots.com/u/diogo.ferreira)\
**Post date:** [October 6, 2023, 6:10am UTC](https://forum.universal-robots.com/t/robot-comunicating-with-pc/30610/6 "2023-10-06T06:10:32Z")

</div>

Thank you @robin_gdwl🙂

---

<div class="post-metadata">

**Author:** ![cags](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.universal-robots.com/cags/32/6304_2.png) [@cags](https://forum.universal-robots.com/u/cags)\
**Post date:** [October 6, 2023, 9:07am UTC](https://forum.universal-robots.com/t/robot-comunicating-with-pc/30610/7 "2023-10-06T09:07:38Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![diogo.ferreira](https://avatars.discourse-cdn.com/v4/letter/d/4af34b/32.png) [@diogo.ferreira](https://forum.universal-robots.com/u/diogo.ferreira)\
**Post date:** [October 6, 2023, 11:44am UTC](https://forum.universal-robots.com/t/robot-comunicating-with-pc/30610/8 "2023-10-06T11:44:17Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![smarmstr](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.universal-robots.com/smarmstr/32/4896_2.png) [@smarmstr](https://forum.universal-robots.com/u/smarmstr)\
**Post date:** [October 7, 2023, 1:24am UTC](https://forum.universal-robots.com/t/robot-comunicating-with-pc/30610/9 "2023-10-07T01:24:05Z")

</div>

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

[Introduction to primary client interface](https://gist.github.com/Shawn-Armstrong/d10932fd992fd5493d93b83520698988)

[URScript Socket example](https://gist.github.com/Shawn-Armstrong/001c14d8496f1362dace27bd6e1535e1)

[Moving the UR3e with ROS2 driver](https://gist.github.com/Shawn-Armstrong/bdbcd51e0d60a0a4e4b60d15c635d3db)

---

<div class="post-metadata">

**Author:** ![diogo.ferreira](https://avatars.discourse-cdn.com/v4/letter/d/4af34b/32.png) [@diogo.ferreira](https://forum.universal-robots.com/u/diogo.ferreira)\
**Post date:** [October 9, 2023, 7:21am UTC](https://forum.universal-robots.com/t/robot-comunicating-with-pc/30610/10 "2023-10-09T07:21:13Z")

</div>

Thank you @smarmstr 🙂

---

<div class="post-metadata">

**Author:** ![roguebuck](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.universal-robots.com/roguebuck/32/4848_2.png) [@roguebuck](https://forum.universal-robots.com/u/roguebuck)\
**Post date:** [October 25, 2023, 7:31pm UTC](https://forum.universal-robots.com/t/robot-comunicating-with-pc/30610/11 "2023-10-25T19:31:05Z")

</div>

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
