universalrobots/ursim_cb3
Universal Robots simulator for CB3 with a VNC based UI
7.3K
The purpose for the docker image is to facilitate and improve the access of the simulator.
Currently, the main purpose is to facilitate Continues Integration tests in our open source Universal Robots ROS Driver and our open source Universal Robots ROS2 driver.
However, the simulator is also handy for other purposes, as the user interface is accessible through a VNC connection.
Disclaimer The docker image is created by UR Labs. It is not yet apart of the official release.
Pull the docker image:
docker pull universalrobots/ursim_cb3
Note you can use tags to pull a specific version.
Run the image:
docker run --rm -it universalrobots/ursim_cb3
It is possible to view the robots user interface, using a VNC application, by connecting to docker_ip:5900
It is possible to view the robots user interface trough a web browser with URL http://docker_ip:6080/vnc.html?host=docker_ip&port=6080
To access the interfaces you need the IP of the docker container which can be found in the terminal launching the simulator, so follow the instructions in the terminal launching the simulator.
The ip address of the docker container can be used to communicate with the robot over the robots different interfaces. For an overview of the interfaces and their respective port see here.
It is also possible to forward the VNC ports to the host machine, this allows you to use localhost to view the robots user interface.
# VNC port: 5900
# Web browser VNC port: 6080
docker run --rm -it -p 5900:5900 -p 6080:6080 universalrobots/ursim_cb3
-p 5900:5900
will publish the VNC port to the host, allowing the host to view the robots user interface with a VNC application, by connecting to localhost:5900.
-p 6080:6080
allows the host to view the robots user interface through a web browser with URL http://localhost:6080/vnc.html?host=localhost&port=6080
The functionality of the docker image can be extended by making another docker image which has this image as base image. Here is a small example, that installs the URCap external-control while building the image. It also copies a folder called programs to the robot, to include premade robot programs.
FROM universalrobots/ursim_cb3
# Install the URCap
COPY externalcontrol-1.0.5.urcap /urcaps/externalcontrol-1.0.5.jar
# Install pre-made programs
COPY programs ursim/programs
Note don't overwrite the entrypoint, as this will prevent the simulator from starting.
The UR Robot can interact with external devices on different interfaces. The same interfaces are also available on the simulator. For an overview of the interfaces and their respective port see here.
It is possible to communicate with these interfaces, using the ip
address of the container. You can also communicate with them over localhost by exposing the ports to the host with the -p
option, see below for an example:
# Dashboard port: 29999
docker run --rm -it -p 29999:29999 universalrobots/ursim_cb3
-p 29999:29999
will expose the dashboard servers interface port to the host interface. Similar approach can be used to expose other interface ports to the host.
The robot model can be selected using the environment variable ROBOT_MODEL
. The models options available are UR3 UR5 UR10
.
The default is UR5
.
The environment variable can be set using the -e
option, see below for an example:
# ROBOT_MODEL: UR10
docker run --rm -it -e ROBOT_MODEL=UR10 universalrobots/ursim_cb3
The /ursim/programs
is used for storing robot programs created when using the
simulator. If one wishes to persist these files beyond the lifecycle of the container,
the /ursim/programs
can be mounted to an external volume on the host.
For example, to save the programs in a ~/programs
folder, launch the container with an additional volume argument:
# Mount ~/programs -> /ursim/programs
docker run --rm -it -v "${HOME}/programs:/ursim/programs" universalrobots/ursim_cb3
URCaps can be installed in three ways.
By inheriting the docker image and extending it with the command of copying the URCap into the /urcaps
folder
FROM universalrobots/ursim_cb3
# Install the URCap
COPY externalcontrol-1.0.5.urcap /urcaps/externalcontrol-1.0.5.jar
Mount the /urcaps
folder to a folder containing the urcaps jar files, at start time. Note It should be the .jar
file and not the .urcap
file that is located inside the folder on the host.
In the example below the hosts ~/urcaps
folder is mounted to the docker containers /urcaps
folder:
# Mount ~/urcaps -> /urcaps
docker run --rm -it -v "${HOME}/urcaps:/urcaps" universalrobots/ursim_cb3
In this way, the URCaps can be installed when starting the container.
Traditional way similar to how you would install the URCap on a real robot:
Create a volume for storing polyscope changes:
docker volume create ursim-gui-cache
Create a volume for storing the URCap build:
docker volume create urcap-build-cache
Start the container.
docker run --rm -it --mount source=ursim-gui-cache,target=/ursim/GUI --mount source=urcap-build-cache,target=/ursim/.urcaps universalrobots/ursim_cb3
Now you can go ahead and install the URCap inside the simulator. Once that is done press restart, and when the simulator reboots the container will stop. You will then have to re-run the container, with the same command as above.
When the container is running you should be able to use the URCap inside the simulator.
It also possible to assign a specific IP address to the container running the simulator, in addition to forward the ports to local host.
Creating a docker network:
docker network create --subnet=192.168.56.0/24 ursim_net
Assign a specific ip address to the container, when running the container:
# IP: 192.168.56.101
docker run --rm -it --net ursim_net --ip 192.168.56.101 -d universalrobots/ursim_cb3
In this way, it is possible to assign other docker containers to the same network and setting up communication between the containers.
It is possible to view the polyscope and control log.
Accesing polyscope and control log, while the container is running.
Start the cotainer.
# Container name: ursim_cb3
docker run --rm -it --name ursim_cb3 universalrobots/ursim_cb3
Open a new terminal to access the polyscope log
docker exec ursim_cb3 tail -f -n200 /ursim/polyscope.log
Open a new terminal to access the control log
docker exec ursim_cb3 tail -f -n200 /ursim/URControl.log
Print the log to the terminal when running the container.
An argument can be passed to the entrypoint file in order to print polyscope or control log to the terminal.
Print polyscope log
# Container name: ursim_cb3
docker run --rm -it --name ursim_cb3 universalrobots/ursim_cb3 "polyscope_log"
Print control log
# Container name: ursim_cb3
docker run --rm -it --name ursim_cb3 universalrobots/ursim_cb3 "control_log"
docker pull universalrobots/ursim_cb3