# Setup ROS Connection between Robot and PC

**URL:** <https://forum.universal-robots.com/t/setup-ros-connection-between-robot-and-pc/17284>\
**Category:** ROS\
**Created:** [October 27, 2021, 9:23pm UTC](https://forum.universal-robots.com/t/setup-ros-connection-between-robot-and-pc/17284 "2021-10-27T21:23:25Z")\
**Posts on this page:** 16\
**Page:** 1

<div class="post-metadata">

**Author:** ![anon48133779](https://avatars.discourse-cdn.com/v4/letter/a/b782af/32.png) [@anon48133779](https://forum.universal-robots.com/u/anon48133779)\
**Post date:** [October 27, 2021, 9:23pm UTC](https://forum.universal-robots.com/t/setup-ros-connection-between-robot-and-pc/17284/1 "2021-10-27T21:23:25Z")

</div>

I’m trying to connect my pc to ur5 with an ethernet cable. When I tried to run a program from the pendant, a popup shows “The connection to the remote PC at 172.22.22.1:50002 could not be established. Reason: Connection refused.”

I checked the firewall. The status is disabled.

Even, pinging the IP addresses is also working. Not sure, why the error says connection refused.

Please let me know, what might be the error?

Thank you in advance!

---

<div class="post-metadata">

**Author:** ![ajp](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.universal-robots.com/ajp/32/471_2.png) [@ajp](https://forum.universal-robots.com/u/ajp)\
**Post date:** [October 29, 2021, 5:37am UTC](https://forum.universal-robots.com/t/setup-ros-connection-between-robot-and-pc/17284/2 "2021-10-29T05:37:46Z")

</div>

Hi @anon48133779,

More information is needed about your setup to help you here as there are many ways that a PC can interact with a UR robot. Are you talking about a ROS connection here?

---

<div class="post-metadata">

**Author:** ![anon48133779](https://avatars.discourse-cdn.com/v4/letter/a/b782af/32.png) [@anon48133779](https://forum.universal-robots.com/u/anon48133779)\
**Post date:** [October 29, 2021, 7:17pm UTC](https://forum.universal-robots.com/t/setup-ros-connection-between-robot-and-pc/17284/3 "2021-10-29T19:17:38Z")

</div>

Yes, it’s a ROS connection.

---

<div class="post-metadata">

**Author:** ![ajp](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.universal-robots.com/ajp/32/471_2.png) [@ajp](https://forum.universal-robots.com/u/ajp)\
**Post date:** [November 1, 2021, 2:36am UTC](https://forum.universal-robots.com/t/setup-ros-connection-between-robot-and-pc/17284/4 "2021-11-01T02:36:55Z")

</div>

Ok I have edited your title and moved the question to the ROS category to increase visibility.

---

<div class="post-metadata">

**Author:** ![anon48133779](https://avatars.discourse-cdn.com/v4/letter/a/b782af/32.png) [@anon48133779](https://forum.universal-robots.com/u/anon48133779)\
**Post date:** [November 1, 2021, 10:31pm UTC](https://forum.universal-robots.com/t/setup-ros-connection-between-robot-and-pc/17284/5 "2021-11-01T22:31:28Z")

</div>

Thank you.

I’m also getting an error when I use this command:

roslaunch ur\_robot\_driver ur5\_bringup.launch robot\_ip:=172.22.22.2 [reverse\_port:=REVERSE\_PORT] kinematics\_config:=${HOME}/my\_robot\_calibration.yaml

Error:  
[INFO] [1635804505.717563440]: Waiting for controller manager service to come up on /controller\_manager/switch\_controller  
[INFO] [1635804505.721090337]: Initializing dashboard client  
[INFO] [1635804505.722433840]: waitForService: Service [/controller\_manager/switch\_controller] has not been advertised, waiting…  
[INFO] [1635804505.724842974]: Connected: Universal Robots Dashboard Server.

[INFO] [1635804505.736611855]: waitForService: Service [/ur\_hardware\_interface/dashboard/play] has not been advertised, waiting…  
[INFO] [1635804505.748223083]: Initializing urdriver  
[WARN] [1635804505.749180976]: No realtime capabilities found. Consider using a realtime system for better performance  
[INFO] [1635804505.759193665]: waitForService: Service [/ur\_hardware\_interface/dashboard/play] is now available.  
[INFO] [1635804506.051336]: Controller Spawner: Waiting for service controller\_manager/load\_controller  
[INFO] [1635804506.089773]: Controller Spawner: Waiting for service controller\_manager/load\_controller  
[INFO] [1635804506.197248908]: Negotiated RTDE protocol version to 2.  
[INFO] [1635804506.197940857]: Setting up RTDE communication with frequency 125.000000  
[INFO] [1635804507.221189952]: Checking if calibration data matches connected robot.  
[WARN] [1635804507.221904867]: No realtime capabilities found. Consider using a realtime system for better performance  
[INFO] [1635804508.317021240]: Calibration checked successfully.  
[WARN] [1635804508.344000205]: No realtime capabilities found. Consider using a realtime system for better performance  
[INFO] [1635804508.344302293]: Loaded ur\_robot\_driver hardware\_interface  
terminate called after throwing an instance of ‘std::runtime\_error’  
what(): Did not find ‘target\_q’ in data sent from robot. This should not happen!  
[INFO] [1635804508.386043241]: waitForService: Service [/controller\_manager/switch\_controller] is now available.  
[INFO] [1635804508.386066908]: Service available.  
[INFO] [1635804508.386077734]: Waiting for controller list service to come up on /controller\_manager/list\_controllers  
[INFO] [1635804508.386746135]: Service available.  
[WARN] [1635804508.478895]: wait\_for\_service(/controller\_manager/load\_controller): failed to contact, will keep trying  
[WARN] [1635804508.519313]: wait\_for\_service(/controller\_manager/load\_controller): failed to contact, will keep trying

================================================================================

REQUIRED process [ur\_hardware\_interface-3] has died!  
process has died [pid 15343, exit code -6, cmd /home/dinesh/mr\_ws/devel\_isolated/ur\_robot\_driver/lib/ur\_robot\_driver/ur\_robot\_driver\_node \_\_name:=ur\_hardware\_interface \_\_log:=/home/dinesh/.ros/log/3ba61f5c-3b60-11ec-b81c-3c2c30f01a2e/ur\_hardware\_interface-3.log].  
log file: /home/dinesh/.ros/log/3ba61f5c-3b60-11ec-b81c-3c2c30f01a2e/ur\_hardware\_interface-3\*.log  
Initiating shutdown!

================================================================================

[ur\_hardware\_interface/ur\_robot\_state\_helper-7] killing on exit  
[controller\_stopper-6] killing on exit  
[ros\_control\_stopped\_spawner-5] killing on exit  
[ros\_control\_controller\_spawner-4] killing on exit  
[ur\_hardware\_interface-3] killing on exit  
[robot\_state\_publisher-2] killing on exit  
[WARN] [1635804508.754701]: Controller Spawner couldn’t find the expected controller\_manager ROS interface.  
[WARN] [1635804508.817489]: Controller Spawner couldn’t find the expected controller\_manager ROS interface.  
^C[controller\_stopper-6] escalating to SIGTERM  
[rosout-1] killing on exit  
[master] killing on exit  
shutting down processing monitor…  
… shutting down processing monitor complete  
done

---

<div class="post-metadata">

**Author:** ![ajp](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.universal-robots.com/ajp/32/471_2.png) [@ajp](https://forum.universal-robots.com/u/ajp)\
**Post date:** [November 2, 2021, 2:55am UTC](https://forum.universal-robots.com/t/setup-ros-connection-between-robot-and-pc/17284/6 "2021-11-02T02:55:53Z")

</div>

If you haven’t already, I’d recommend looking through previously addressed issues on the driver github repository to see if anything matches your problem. If you can’t find anything then raising the issue there would make sense.

> **[Issues · UniversalRobots/Universal\_Robots\_ROS\_Driver](https://github.com/UniversalRobots/Universal_Robots_ROS_Driver/issues)**
>
> Universal Robots ROS driver supporting CB3 and e-Series - Issues · UniversalRobots/Universal\_Robots\_ROS\_Driver

---

<div class="post-metadata">

**Author:** ![anon64765368](https://avatars.discourse-cdn.com/v4/letter/a/ee59a6/32.png) [@anon64765368](https://forum.universal-robots.com/u/anon64765368)\
**Post date:** [April 6, 2022, 4:37pm UTC](https://forum.universal-robots.com/t/setup-ros-connection-between-robot-and-pc/17284/7 "2022-04-06T16:37:48Z")

</div>

Any update on this? Has it been solved, I have the same issue.

---

<div class="post-metadata">

**Author:** ![anon64765368](https://avatars.discourse-cdn.com/v4/letter/a/ee59a6/32.png) [@anon64765368](https://forum.universal-robots.com/u/anon64765368)\
**Post date:** [April 6, 2022, 4:52pm UTC](https://forum.universal-robots.com/t/setup-ros-connection-between-robot-and-pc/17284/8 "2022-04-06T16:52:05Z")

</div>

Solved this by opening the port on the PC with nc -lk 50002

---

<div class="post-metadata">

**Author:** ![anon58002450](https://avatars.discourse-cdn.com/v4/letter/a/e8c25b/32.png) [@anon58002450](https://forum.universal-robots.com/u/anon58002450)\
**Post date:** [June 1, 2022, 2:26pm UTC](https://forum.universal-robots.com/t/setup-ros-connection-between-robot-and-pc/17284/9 "2022-06-01T14:26:48Z")

</div>

Same here. “nc -lk 50002” did not work. Any other solution?

---

<div class="post-metadata">

**Author:** ![mauch](https://avatars.discourse-cdn.com/v4/letter/m/71e660/32.png) [@mauch](https://forum.universal-robots.com/u/mauch)\
**Post date:** [June 2, 2022, 9:27am UTC](https://forum.universal-robots.com/t/setup-ros-connection-between-robot-and-pc/17284/10 "2022-06-02T09:27:09Z")

</div>

First of all: Which ROS version are we talking about? What is your network setup? Usually this can happen when

- The wrong PC address is configured on the teach pendant
- There is a firewall blocking access on the ROS machine
- The reverse port has been altered on the ROS side, but not on the robot
- The ROS machine is not reachable on the device that the port is opened for (this can happen for example in a VM/Docker NAT situation

Therefore, in order to assist you in finding a solution, we would have to know a bit more about your system setup.

---

<div class="post-metadata">

**Author:** ![anon58002450](https://avatars.discourse-cdn.com/v4/letter/a/e8c25b/32.png) [@anon58002450](https://forum.universal-robots.com/u/anon58002450)\
**Post date:** [June 2, 2022, 1:47pm UTC](https://forum.universal-robots.com/t/setup-ros-connection-between-robot-and-pc/17284/11 "2022-06-02T13:47:26Z")

</div>

Hey, thanks for replying and sorry for not elaborating.  
I am working on ROS2 Foxy, my network setup is UR3e (192.168.0.4) \> router \> PC (Ubuntu with IP 192.168.0.2 and another network for docker with IP 172.17.0.1) \> ROS2 (through docker with IP 172.17.0.2)

- I set up host IP on the robot 192.168.0.2, and robot’s IP 192.168.0.4

- I installed the external control urcap

- I tried with both enable/disable remote control, and with both local/remote control on teach pendant

- Firewall is disabled (sudo ufw status: inactive)

- I run

```auto
ros2 launch ur_bringup ur_control.launch.py ur_type:=ur5e robot_ip:=192.168.0.4 launch_rviz:=true reverse_ip:=192.168.0.2

```

- ping 192.168.0.4 shows successful connection

- Also when I connect to the robot through ssh, and I ping 192.168.0.2 shows successful connection.

- I also tried with setting as host IP the docker’s IP: 172.17.0.2 and the robot’s IP: 172.17.0.3 but this doesnt even ping.

For all these, the error is the same: Connection refused.  
Attached is my installation and program configuration.

Thank you for your time,

[URconfig.zip](https://forum.universal-robots.com/uploads/short-url/kiFA06HZ1qPCYztQnD9PJrRk1Le.zip) (3.7 KB)

---

<div class="post-metadata">

**Author:** ![mauch](https://avatars.discourse-cdn.com/v4/letter/m/71e660/32.png) [@mauch](https://forum.universal-robots.com/u/mauch)\
**Post date:** [June 9, 2022, 10:19am UTC](https://forum.universal-robots.com/t/setup-ros-connection-between-robot-and-pc/17284/12 "2022-06-09T10:19:01Z")

</div>

If you run the driver inside your docker container you’ll have to make sure that the robot can reach it either by adding some routing schemes or by using port forwarding when starting your docker container.

For example, the robot will try to connect to port 50002. The ROS driver will open this port inside the docker container, but this will not be visible for machines outside of the docker network.

From my experience with docker the most straight-forward solution would be to forward ports 50001, 50002 and 50003 from the host to the docker machine (add `-p 50001-50003:50001-50003` to your docker startup command)

---

<div class="post-metadata">

**Author:** ![anon58002450](https://avatars.discourse-cdn.com/v4/letter/a/e8c25b/32.png) [@anon58002450](https://forum.universal-robots.com/u/anon58002450)\
**Post date:** [June 9, 2022, 11:55am UTC](https://forum.universal-robots.com/t/setup-ros-connection-between-robot-and-pc/17284/13 "2022-06-09T11:55:06Z")

</div>

> [@mauch](#):
>
> `-p 50001-50003:50001-50003`

This saved my day @mauch thank you a lot!

There is however another problem now. Even though I am able to connect to the robot (and even visualize its pose in rviz), when I try

```auto
ur_moveit.launch.py

```

the robot start state is in a colliding state, and thus there is no way I can plan any trajectory since every state seems to be colliding.

Any idea why is this happening? I may post this question as a different post, if this proves to be an independent from the port issue

PS. On the end effector I have a tool (VGC10) I haven’t yet configured in ROS. Does this creates any problem?

---

<div class="post-metadata">

**Author:** ![mauch](https://avatars.discourse-cdn.com/v4/letter/m/71e660/32.png) [@mauch](https://forum.universal-robots.com/u/mauch)\
**Post date:** [June 9, 2022, 3:34pm UTC](https://forum.universal-robots.com/t/setup-ros-connection-between-robot-and-pc/17284/14 "2022-06-09T15:34:23Z")

</div>

The robot should not by default start in a colliding state. However, you could try moving the robot to a different configuration and try again. If that doesn’t help, I guess we would need more info of how it is colliding (screenshot, output…) But yes, I think this is better suitable for a new post

---

<div class="post-metadata">

**Author:** ![s306044](https://avatars.discourse-cdn.com/v4/letter/s/e79b87/32.png) [@s306044](https://forum.universal-robots.com/u/s306044)\
**Post date:** [July 16, 2024, 9:44am UTC](https://forum.universal-robots.com/t/setup-ros-connection-between-robot-and-pc/17284/15 "2024-07-16T09:44:31Z")

</div>

Good morning, i have the same problem but with a different configuration and i wonder if the problem could be solved in the same way.  
I have an UR3 (CB series) on top of a MIR (mobile robot), and i want to connect them both on ROS, so i have the ethernet cable that goes from the UR to the MIR, so they are connected, and then i connect the computer to the MIR Wi-Fi, so the IP of the MIR is 192.168.12.20, the IP of the robot if 192.168.12.2 and the IP of the host computer is 192.168.12.192. In the teach pendant, i wrote in the Host IP of the URcap the Host computer’s IP, but the problem is that after i launch the command ‘roslaunch ur\_robot\_driver ur3\_bringup.launch robot\_ip:=192.168.12.2 kinematics\_config:=$(rospack find ur\_calibration)/ur3\_robot\_calibration.yaml’ (that runs correctly), if i then try to run the URcap program on the teach pendant it tells me ‘the connection to the remote PC at 192.168.12.192:50002 could not be established. reason:connect timed out’. If i ping the UR’IP from ROS i can see it, but the UR does not see the computer.  
EDIT: i found out that i had an active firewall, so i disabled it, and now i have this new error:

[INFO] [1721124400.383903627]: Robot connected to reverse interface. Ready to receive control commands.  
[INFO] [1721124400.603082789]: Connection to reverse interface dropped.  
[ERROR] [1721124400.603212743]: Sending data through socket failed.  
[INFO] [1721124400.612000570]: Robot connected to reverse interface. Ready to receive control commands.  
[INFO] [1721124400.898997001]: Connection to reverse interface dropped.  
[INFO] [1721124400.904126649]: Robot connected to reverse interface. Ready to receive control commands.  
[INFO] [1721124403.044618221]: Connection to reverse interface dropped.  
[ERROR] [1721124403.044718419]: Sending data through socket failed.

So i guess is one of the other two problems that mauch pointed, what i have to do in order so solve them? thank you in advance

---

<div class="post-metadata">

**Author:** ![vasilis.skarleas](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.universal-robots.com/vasilis.skarleas/32/6991_2.png) [@vasilis.skarleas](https://forum.universal-robots.com/u/vasilis.skarleas)\
**Post date:** [April 30, 2025, 1:13pm UTC](https://forum.universal-robots.com/t/setup-ros-connection-between-robot-and-pc/17284/16 "2025-04-30T13:13:01Z")

</div>

If you are on CB series and you receive an issue like this, one of the causes for me was the fact that under Installation \> EtherNet/IP , the adapter was activated and caused the same situation that you described. I deactivated the adapter, relaunched the drivers on the PC and finally it worked.
