Cannot run externalcontrol-1.0.5 urcap on Docker ursim container

Hello,

I am unable to run the externalcontrol urcap on the teach pendant in a docker container created from the universalrobots/ursim_e-series image. I get a “connect timed out” error message. I am running the ursim in one docker container, and have ros humble running on ubuntu 22.04 in another docker container on the same bridge network.

Here are my steps outlined below for repeatability:

On my host machine (windows 11), I open the command prompt.

# [cmd] create user-defined bridge network
docker network create --subnet 192.168.1.0/24 urnet 

# [cmd] after downloading externalcontrol-1.0.5.jar to .\urcaps, start the ursim in new container
docker run -it --network urnet --name ursim -e ROBOT_MODEL=UR3 -p 6080:6080 -v .\urcaps:/urcaps/ universalrobots/ursim_e-series

I navigate to http://localhost:6080/vnc.html in my web browser and connect to the teach pendant. Then, I power on the robot.

Now, in a new command prompt, I start up another docker container and install the ros-humble-ur driver. The -e DISPLAY=host.docker.internal:0.0 just allows me to see the RViz window using the free XLaunch program.

# [cmd] start docker container with ros2:humble installed
docker run -it --network urnet --name ros_container -e DISPLAY=host.docker.internal:0.0 osrf/ros:humble-desktop-full

# [ros_container] install ros-humble-ur driver
apt-get update && apt-get install -y ros-humble-ur

# [ros_container] source ros2
source /opt/ros/humble/setup.bash

In a new command prompt, I check the IP addresses of my docker containers

# [cmd] get IP addresses of docker containers
docker network inspect urnet
# output
... {"Name": "ursim", "IPv4Address": "192.168.1.3/24",},
... {"Name", "ros_container", "IPv4Address": "192.168.1.2/24"}

Then I launch the ur_robot_driver.

# {ros_container} launch the ur_robot_driver
ros2 launch ur_robot_driver ur_control.launch.py ur_type:=ur3e robot_ip:=192.168.1.3 use_fake_hardware:=true launch_rviz:=true

At this point, RViz is open and I can visually inspect that the ur3e arm is in the in the home position (arm raised straight up in the air).

Now I open another terminal to ros_container and then run the ur_robot_driver to make the robot move in RViz.

# [cmd] get access to ros_container terminal
docker exec -it ros_container bash

# [ros_container] source ros2
source /opt/ros/humble/setup.bash

# [ros_container] make the robot move
ros2 launch ur_robot_driver test_scaled_joint_trajectory_controller.launch.py

At this point, the robot is moving in RViz. However, when the robot is not moving on the teaching pendant. Additionally, when I configure the urcap in the installation menu (setting the IP address of remote PC to 192.168.56.2), insert the External Control programming node and hit run, I get a “connect timed out” error message.

I have two questions:

  1. How do I use the externalcontrol urcap on the simulator?
  2. Can I run a program from the simulator and make the robot movements appear in RViz?

Thank you,

Logan Dihel
PhD Student
Purdue University

Hi @ldihel , I am facing a similar problem. Have you gotten a solution to this problem?

1 Like

Yes, I have everything working with ROS 2 humble, both on my windows computer (with docker) and my ubuntu 22.04 computer (with docker for the simulator or the actual UR3e robot).

For windows, install docker, clone this repo and then follow the instructions in the README file for “Using Docker”. This requires about 12 GB of RAM on my machine.

For linux, install ros2 humble. Then, install the ur_robot_driver. Then, you can have some fun. Documentation is provided here

You can either run in headless mode or by using the “external control” UR cap. Let’s start with the “external control” UR Cap.

External Control on Real Hardware

If you have an actual robot, then do the following:

Put the Teach Pendent into Local mode. Move the robot into Home position. In the Program tab, add the External Control URCAP to the first line of the program. In terminal window 1, run the following command:

ros2 launch ur_robot_driver ur_control.launch.py ur_type:=ur3e robot_ip:=192.168.1.102 headless_mode:=false

In the Teach Pendent, run the program. It should not crash now. In terminal window 2, run the following command:

ros2 launch ur_robot_driver test_scaled_joint_trajectory_controller.launch.py robot_ip:=192.168.1.102 ur_type:=ur3e

Trouble Shooting

Ensure the robot is in the Home position [0, -90, 0, -90, 0, 0]. (degrees)
Ensure the robot is in “Remote Control” mode (as opposed to Local mode, top right corner on Teach Pendent).
Ensure the ur_control.launch.py hasn’t crashed.
Ensure all IP addresses are configured correctly on your machine and the robot (should both start with 192.168.1)
If all else fails, hit Ctrl+C on both terminal windows and try again.

Remote Control on Real Hardware (Headless)

Turn on the robot, move to the Home position, and then activate Remote control on the top menu. In terminal window 1, run the following command:

ros2 launch ur_robot_driver ur_control.launch.py ur_type:=ur3e robot_ip:=192.168.1.102 headless_mode:=true

Within a few seconds, in termainal window 2, run the following command:

ros2 launch ur_robot_driver test_scaled_joint_trajectory_controller.launch.py robot_ip:=192.168.1.102 ur_type:=ur3e

Headless Mode with Docker Simulator

The docker image for the ur robot simulator is here. You may need to pull it before continuing.
Start the Docker simulator:

ros2 run ur_client_library start_ursim.sh -m ur3e

Go to the virtual Teach Pendent, turn on robot, move to Home position. Go to settings to enable Remote control, then exit settings and activate Remote control mode in the top menu.
In terminal window 1, run the following command:

ros2 launch ur_robot_driver ur_control.launch.py ur_type:=ur3e robot_ip:=192.168.56.101 launch_rviz:=true headless_mode:=true

In terminal window 2, run:

ros2 launch ur_robot_driver test_scaled_joint_trajectory_controller.launch.py

Hope this gives you a good start! Let me know if you have any questions. This whole thing took me about 40 hours of work over a few weeks to finally figure out, and some things still aren’t working. Using Linux is WAY easier than doing it all in windows by the way. If you have access to a linux machine or are willing to dual boot, that is the way to go.