ROS2 External Control Connection refused

Hi,

I’m currently trying to connect my UR5e with my PC to control it via ROS2. I installed the URCap for external control but when I try to run it I only get a popup which says “The Connection to the remote PC at 192.168.1.21 could not be established. Reason: Connection refused (Connection refused)”.

I tried different IP-addresses for the PC and the Robot an forwarded the Ports to my Docker Container. I can ping the Robot and even connect my pc via ssh to it. The firewall status is disabled.

Please let me know, what might be the error?

Thank you in advance!

If you run the driver in a docker container with a standard NAT interface, you’ll need to do two things:

  • Setup port forwarding of ports 50001-50004 from your docker host to the driver’s container
  • Setup the docker host’s IP address on the robot’s teach pendant

what os does your docker host have? Does the docker host run any firewall?

I forwarded the Ports and neither the docker container nor the host has any firewall running.

My container has ubuntu 20.04 as os.

I’ve been investigating that a bit more and this issue is probably related: Reverse IP parameter missing for ROS2 driver · Issue #420 · UniversalRobots/Universal_Robots_ROS2_Driver · GitHub

As a workaround for now, please see Real robot is not moving with moveit - #5 by alexnic31.

Edit: Reading the OP once again, the reverse IP is most probably not the problem at this stage (though it will be in the next step).

Just to verify:

  • Your robot"s IP is 192.168.1.something
  • Your docker host"s IP is 192.168.1.21
  • You have enabled port forwarding for your ubuntu docker container meaning docker container ls shows ports 50001-50004 in the PORTS column

Are all of the above true? When all of these are answered with “yes” I would assume that tings work.

Had some minor Problems at the beginning, but made it work like you said. Thank you very much!