Skip to content

Commit b7117ed

Browse files
urrskFelix Exner
authored andcommitted
Remove Dockerfile
The dockerfile is no longer needed as the repo now uses the docker image
1 parent 7a75157 commit b7117ed

File tree

7 files changed

+208
-291
lines changed

7 files changed

+208
-291
lines changed

.github/workflows/ci.yml

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,22 +8,24 @@ jobs:
88
strategy:
99
matrix:
1010
env:
11-
- DOCKER_RUN_OPTS: --network static_test_net
11+
- DOCKER_RUN_OPTS: --network ursim_net
1212
BEFORE_INIT: 'apt-get update -qq && apt-get install -y iproute2 iputils-ping && ip addr && ping -c5 192.168.56.101'
1313
CTEST_OUTPUT_ON_FAILURE: 1
14-
URSIM_DOCKER_IMAGE: 'universalrobots/ursim_cb3:3.12.1'
15-
PROGRAM_FOLDER: 'programs/cb3'
16-
- DOCKER_RUN_OPTS: --network static_test_net
14+
ROBOT_MODEL: 'ur5'
15+
URSIM_VERSION: '3.12.1'
16+
PROGRAM_FOLDER: 'tests/resources/dockerursim/programs/cb3'
17+
- DOCKER_RUN_OPTS: --network ursim_net
1718
BEFORE_INIT: 'apt-get update -qq && apt-get install -y iproute2 iputils-ping && ip addr && ping -c5 192.168.56.101'
1819
CTEST_OUTPUT_ON_FAILURE: 1
19-
URSIM_DOCKER_IMAGE: 'universalrobots/ursim_e-series:5.5.1'
20-
PROGRAM_FOLDER: 'programs/e-series'
20+
ROBOT_MODEL: 'ur5e'
21+
URSIM_VERSION: '5.5.1'
22+
PROGRAM_FOLDER: 'tests/resources/dockerursim/programs/e-series'
2123

2224
steps:
2325
- uses: actions/checkout@v1
2426
- name: start ursim
2527
run: |
26-
tests/resources/dockerursim/build_and_run_docker_ursim.sh $URSIM_DOCKER_IMAGE $PROGRAM_FOLDER
28+
scripts/start_ursim.sh -m $ROBOT_MODEL -v $URSIM_VERSION -p $PROGRAM_FOLDER -d
2729
env: ${{matrix.env}}
2830
- name: install gtest
2931
run: sudo apt-get install -y libgtest-dev
@@ -64,7 +66,8 @@ jobs:
6466
--exclude-dir=CMakeModules \
6567
--exclude=tcp_socket.cpp \
6668
--exclude-dir=debian \
67-
--exclude=real_time.md
69+
--exclude=real_time.md \
70+
--exclude=start_ursim.sh
6871
6972
rosdoc_lite_check:
7073
runs-on: ubuntu-latest

.github/workflows/industrial-ci.yml

Lines changed: 25 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -23,61 +23,67 @@ jobs:
2323
ROS_REPO: main
2424
IMMEDIATE_TEST_OUTPUT: true
2525
DOWNSTREAM_WORKSPACE: "github:UniversalRobots/Universal_Robots_ROS_Driver#master https://raw.githubusercontent.com/UniversalRobots/Universal_Robots_ROS_Driver/master/.melodic.rosinstall"
26-
DOCKER_RUN_OPTS: --network static_test_net
26+
DOCKER_RUN_OPTS: --network ursim_net
2727
BEFORE_INIT: 'apt-get update -qq && apt-get install -y iproute2 iputils-ping && ip addr && ping -c5 192.168.56.101'
28-
URSIM_DOCKER_IMAGE: 'universalrobots/ursim_e-series:5.5.1'
29-
PROGRAM_FOLDER: 'programs/e-series'
28+
URSIM_VERSION: '5.5.1'
29+
ROBOT_MODEL: 'ur5e'
30+
PROGRAM_FOLDER: 'tests/resources/dockerursim/programs/e-series'
3031
- ROS_DISTRO: noetic
3132
ROS_REPO: main
3233
IMMEDIATE_TEST_OUTPUT: true
3334
DOWNSTREAM_WORKSPACE: "github:UniversalRobots/Universal_Robots_ROS_Driver#master https://raw.githubusercontent.com/UniversalRobots/Universal_Robots_ROS_Driver/master/.noetic.rosinstall"
3435
BUILDER: catkin_tools
35-
DOCKER_RUN_OPTS: --network static_test_net
36+
DOCKER_RUN_OPTS: --network ursim_net
3637
BEFORE_INIT: 'apt-get update -qq && apt-get install -y iproute2 iputils-ping && ip addr && ping -c5 192.168.56.101'
37-
URSIM_DOCKER_IMAGE: 'universalrobots/ursim_e-series:5.5.1'
38-
PROGRAM_FOLDER: 'programs/e-series'
38+
URSIM_VERSION: '5.5.1'
39+
ROBOT_MODEL: 'ur5e'
40+
PROGRAM_FOLDER: 'tests/resources/dockerursim/programs/e-series'
3941
- ROS_DISTRO: foxy
4042
ROS_REPO: main
4143
IMMEDIATE_TEST_OUTPUT: true
4244
DOWNSTREAM_WORKSPACE: "github:UniversalRobots/Universal_Robots_ROS2_Driver#foxy"
43-
DOCKER_RUN_OPTS: --network static_test_net
45+
DOCKER_RUN_OPTS: --network ursim_net
4446
BEFORE_INIT: 'apt-get update -qq && apt-get install -y iproute2 iputils-ping && ip addr && ping -c5 192.168.56.101'
45-
URSIM_DOCKER_IMAGE: 'universalrobots/ursim_e-series:5.5.1'
46-
PROGRAM_FOLDER: 'programs/e-series'
47+
URSIM_VERSION: '5.5.1'
48+
ROBOT_MODEL: 'ur5e'
49+
PROGRAM_FOLDER: 'tests/resources/dockerursim/programs/e-series'
4750
NOT_TEST_DOWNSTREAM: true
4851
- ROS_DISTRO: galactic
4952
ROS_REPO: main
5053
IMMEDIATE_TEST_OUTPUT: true
5154
DOWNSTREAM_WORKSPACE: "github:UniversalRobots/Universal_Robots_ROS2_Driver#galactic"
52-
DOCKER_RUN_OPTS: --network static_test_net
55+
DOCKER_RUN_OPTS: --network ursim_net
5356
BEFORE_INIT: 'apt-get update -qq && apt-get install -y iproute2 iputils-ping && ip addr && ping -c5 192.168.56.101'
54-
URSIM_DOCKER_IMAGE: 'universalrobots/ursim_e-series:5.5.1'
55-
PROGRAM_FOLDER: 'programs/e-series'
57+
URSIM_VERSION: '5.5.1'
58+
ROBOT_MODEL: 'ur5e'
59+
PROGRAM_FOLDER: 'tests/resources/dockerursim/programs/e-series'
5660
NOT_TEST_DOWNSTREAM: true
5761
- ROS_DISTRO: humble
5862
ROS_REPO: main
5963
IMMEDIATE_TEST_OUTPUT: true
6064
DOWNSTREAM_WORKSPACE: "github:UniversalRobots/Universal_Robots_ROS2_Driver#main https://raw.githubusercontent.com/UniversalRobots/Universal_Robots_ROS2_Driver/main/Universal_Robots_ROS2_Driver-not-released.humble.repos"
61-
DOCKER_RUN_OPTS: --network static_test_net
65+
DOCKER_RUN_OPTS: --network ursim_net
6266
BEFORE_INIT: 'apt-get update -qq && apt-get install -y iproute2 iputils-ping && ip addr && ping -c5 192.168.56.101'
63-
URSIM_DOCKER_IMAGE: 'universalrobots/ursim_e-series:5.5.1'
64-
PROGRAM_FOLDER: 'programs/e-series'
67+
URSIM_VERSION: '5.5.1'
68+
ROBOT_MODEL: 'ur5e'
69+
PROGRAM_FOLDER: 'tests/resources/dockerursim/programs/e-series'
6570
NOT_TEST_DOWNSTREAM: true
6671
- ROS_DISTRO: rolling
6772
ROS_REPO: main
6873
IMMEDIATE_TEST_OUTPUT: true
6974
DOWNSTREAM_WORKSPACE: "github:UniversalRobots/Universal_Robots_ROS2_Driver#main https://raw.githubusercontent.com/UniversalRobots/Universal_Robots_ROS2_Driver/main/Universal_Robots_ROS2_Driver-not-released.rolling.repos"
70-
DOCKER_RUN_OPTS: --network static_test_net
75+
DOCKER_RUN_OPTS: --network ursim_net
7176
BEFORE_INIT: 'apt-get update -qq && apt-get install -y iproute2 iputils-ping && ip addr && ping -c5 192.168.56.101'
72-
URSIM_DOCKER_IMAGE: 'universalrobots/ursim_e-series:5.5.1'
73-
PROGRAM_FOLDER: 'programs/e-series'
77+
URSIM_VERSION: '5.5.1'
78+
ROBOT_MODEL: 'ur5e'
79+
PROGRAM_FOLDER: 'tests/resources/dockerursim/programs/e-series'
7480
NOT_TEST_DOWNSTREAM: true
7581

7682
steps:
7783
- uses: actions/checkout@v1
7884
- name: start ursim
7985
run: |
80-
tests/resources/dockerursim/build_and_run_docker_ursim.sh $URSIM_DOCKER_IMAGE $PROGRAM_FOLDER
86+
scripts/start_ursim.sh -m $ROBOT_MODEL -v $URSIM_VERSION -p $PROGRAM_FOLDER -d
8187
env: ${{matrix.env}}
8288
- uses: 'ros-industrial/industrial_ci@master'
8389
env: ${{matrix.env}}

scripts/start_ursim.sh

Lines changed: 172 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,172 @@
1+
#!/bin/bash
2+
3+
# copyright 2022 Universal Robots A/S
4+
#
5+
# Redistribution and use in source and binary forms, with or without
6+
# modification, are permitted provided that the following conditions are met:
7+
#
8+
# * Redistributions of source code must retain the above copyright
9+
# notice, this list of conditions and the following disclaimer.
10+
#
11+
# * Redistributions in binary form must reproduce the above copyright
12+
# notice, this list of conditions and the following disclaimer in the
13+
# documentation and/or other materials provided with the distribution.
14+
#
15+
# * Neither the name of the {copyright_holder} nor the names of its
16+
# contributors may be used to endorse or promote products derived from
17+
# this software without specific prior written permission.
18+
#
19+
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20+
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21+
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22+
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
23+
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24+
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25+
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26+
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27+
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28+
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29+
# POSSIBILITY OF SUCH DAMAGE.
30+
31+
PERSISTENT_BASE="${HOME}/.ursim"
32+
33+
help()
34+
{
35+
# Display Help
36+
echo "Starts URSim inside a docker container"
37+
echo
38+
echo "Syntax: `basename "$0"` [-m|s|h]"
39+
echo "options:"
40+
echo " -m <model> Robot model. One of [ur3, ur3e, ur5, ur5e, ur10, ur10e, ur16e]. Defaults to ur5e."
41+
echo " -v <version> URSim version that should be used.
42+
See https://hub.docker.com/r/universalrobots/ursim_e-series/tags
43+
for available versions. Defaults to 'latest'"
44+
echo " -p <folder> Location from which programs are read / to which programs are written.
45+
If not specified, will fallback to ${PERSISTENT_BASE}/${ROBOT_SERIES}/programs"
46+
echo " -u <folder> Location from which URCaps are read / to which URCaps are written.
47+
If not specified, will fallback to ${PERSISTENT_BASE}/${ROBOT_SERIES}/urcaps"
48+
echo " -d Detached mode - start in backgound"
49+
echo " -h Print this Help."
50+
echo
51+
}
52+
53+
ROBOT_MODEL=UR5
54+
ROBOT_SERIES=e-series
55+
URSIM_VERSION=latest
56+
URCAP_STORAGE="${PERSISTENT_BASE}/${ROBOT_SERIES}/urcaps"
57+
PROGRAM_STORAGE="${PERSISTENT_BASE}/${ROBOT_SERIES}/programs"
58+
DETACHED=false
59+
60+
61+
validate_model()
62+
{
63+
case $ROBOT_MODEL in
64+
ur3|ur5|ur10)
65+
ROBOT_MODEL=${ROBOT_MODEL^^}
66+
ROBOT_SERIES=cb3
67+
;;
68+
ur3e|ur5e|ur10e|ur16e)
69+
ROBOT_MODEL=${ROBOT_MODEL^^}
70+
ROBOT_MODEL=$(echo ${ROBOT_MODEL:0:$((${#ROBOT_MODEL}-1))})
71+
ROBOT_SERIES=e-series
72+
;;
73+
*)
74+
echo "Not a valid robot model: $ROBOT_MODEL"
75+
exit
76+
;;
77+
esac
78+
}
79+
80+
verlte()
81+
{
82+
[ "$1" = $(printf "$1\n$2" | sort -V | head -n1) ]
83+
}
84+
85+
validate_ursim_version()
86+
{
87+
[ $URSIM_VERSION == "latest" ] && return 0
88+
local MIN_CB3="3.12.1"
89+
local MIN_E_SERIES="5.5.1"
90+
91+
case $ROBOT_SERIES in
92+
cb3)
93+
verlte "4.0.0" $URSIM_VERSION && echo "$URSIM_VERSION is no valid CB3 version!" && exit
94+
verlte $MIN_CB3 $URSIM_VERSION && return 0
95+
;;
96+
e-series)
97+
verlte $MIN_E_SERIES $URSIM_VERSION && return 0
98+
;;
99+
esac
100+
101+
echo "Illegal version given. Version must be greater or equal to $MIN_CB3 / $MIN_E_SERIES. Given version: $URSIM_VERSION."
102+
exit
103+
}
104+
105+
106+
while getopts ":hm:v:p:u:d" option; do
107+
case $option in
108+
h) # display Help
109+
help
110+
exit;;
111+
m) # robot model
112+
ROBOT_MODEL=${OPTARG}
113+
validate_model
114+
;;
115+
v) # ursim_version
116+
URSIM_VERSION=${OPTARG}
117+
validate_ursim_version
118+
;;
119+
p) # program_folder
120+
PROGRAM_STORAGE=${OPTARG}
121+
;;
122+
u) # urcaps_folder
123+
URCAP_STORAGE=${OPTARG}
124+
;;
125+
d) # detached mode
126+
DETACHED=true
127+
;;
128+
\?) # invalid option
129+
echo "Error: Invalid option"
130+
help
131+
exit;;
132+
esac
133+
done
134+
135+
# Create local storage for programs and URCaps
136+
mkdir -p "${URCAP_STORAGE}"
137+
mkdir -p "${PROGRAM_STORAGE}"
138+
URCAP_STORAGE=$(realpath "$URCAP_STORAGE")
139+
PROGRAM_STORAGE=$(realpath "$PROGRAM_STORAGE")
140+
141+
142+
# Check whether network already exists
143+
docker network inspect ursim_net > /dev/null
144+
if [ $? -eq 0 ]; then
145+
echo "ursim_net already exists"
146+
else
147+
echo "Creating ursim_net"
148+
docker network create --subnet=192.168.56.0/24 ursim_net
149+
fi
150+
151+
# run docker contain
152+
docker run --rm -d --net ursim_net --ip 192.168.56.101\
153+
-v "${URCAP_STORAGE}":/urcaps \
154+
-v "${PROGRAM_STORAGE}":/ursim/programs \
155+
-e ROBOT_MODEL="${ROBOT_MODEL}" \
156+
--name ursim \
157+
universalrobots/ursim_${ROBOT_SERIES}:$URSIM_VERSION || exit
158+
159+
trap "echo killing; docker container kill ursim; exit" SIGINT SIGTERM
160+
161+
echo "Docker URSim is running"
162+
printf "\nTo access Polyscope, open the following URL in a web browser.\n\thttp://192.168.56.101:6080/vnc.html\n\n"
163+
164+
if [ "$DETACHED" = false ]; then
165+
echo "To exit, press CTRL+C"
166+
while :
167+
do
168+
sleep 1
169+
done
170+
else
171+
echo "To kill it, please execute 'docker stop ursim'"
172+
fi

0 commit comments

Comments
 (0)