Skip to content

Commit fdfac21

Browse files
committed
Further robustifications
1 parent 9fc2f78 commit fdfac21

File tree

1 file changed

+18
-14
lines changed

1 file changed

+18
-14
lines changed

scripts/start_ursim.sh

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,12 @@ help()
6666
echo
6767
}
6868

69-
#ROBOT_MODEL=ur5e
70-
#ROBOT_SERIES=e-series
69+
ROBOT_MODEL=""
70+
ROBOT_SERIES=""
7171
URSIM_VERSION=latest
72+
PORT_FORWARDING=""
73+
PROGRAM_STORAGE_ARG=""
74+
URCAP_STORAGE_ARG=""
7275
DETACHED=false
7376

7477
verlte()
@@ -106,13 +109,15 @@ get_series_from_model()
106109
get_series_from_version()
107110
{
108111
if [[ "$URSIM_VERSION" == "latest" ]]; then
109-
ROBOT_SERIES=e-series
112+
ROBOT_SERIES=e-series && return
110113
else
111-
verlte "10.0.0" "$URSIM_VERSION" && ROBOT_SERIES=polyscopex && return
112-
verlte "5.0.0" "$URSIM_VERSION" && ROBOT_SERIES=e-series && return
114+
verlte "10.0.0" "$URSIM_VERSION" && verlte "$URSIM_VERSION" "11.0.0" && ROBOT_SERIES=polyscopex && return
115+
verlte "5.0.0" "$URSIM_VERSION" && verlte "$URSIM_VERSION" "6.0.0" && ROBOT_SERIES=e-series && return
116+
verlte "3.0.0" "$URSIM_VERSION" && verlte "$URSIM_VERSION" "4.0.0" && ROBOT_SERIES=cb3 && return
113117
fi
114118
# If nothing above matched
115-
ROBOT_SERIES=cb3
119+
echo "URSim version $URSIM_VERSION is not supported"
120+
exit 1
116121
}
117122

118123
# Bring the model into a format that is used internally by URSim
@@ -159,9 +164,12 @@ validate_parameters()
159164

160165
case $ROBOT_SERIES in
161166
cb3)
167+
MIN_VERSION=$MIN_CB3
168+
if [[ $ROBOT_MODEL != @(ur3|ur5|ur10) ]]; then
169+
echo "$ROBOT_MODEL is no valid CB3 model!" && exit 1
170+
fi
162171
verlte "4.0.0" "$IMAGE_URSIM_VERSION" && echo "$IMAGE_URSIM_VERSION is no valid CB3 version!" && exit 1
163172
verlte "$MIN_CB3" "$IMAGE_URSIM_VERSION" && return 0
164-
MIN_VERSION=$MIN_CB3
165173
;;
166174
e-series)
167175
if [[ $ROBOT_MODEL != @(ur3e|ur5e|ur10e|ur16e|ur20|ur30) ]]; then
@@ -279,11 +287,7 @@ fill_information() {
279287
if [ -z "$ROBOT_MODEL" ]; then
280288
echo "No robot model given. Inferring from series"
281289
if [ -z "$ROBOT_SERIES" ]; then
282-
if [ "$URSIM_VERSION" != "latest" ]; then
283-
get_series_from_version
284-
else
285-
ROBOT_SERIES=e-series
286-
fi
290+
get_series_from_version
287291
fi
288292
if [[ "$ROBOT_SERIES" == "cb3" ]]; then
289293
ROBOT_MODEL=ur5
@@ -341,10 +345,10 @@ main() {
341345
DOCKER_ARGS="$DOCKER_ARGS --privileged"
342346
fi
343347

344-
if [ -n "$PROGRAM_STORAGE_ARG" ]; then
348+
if [ -z "$PROGRAM_STORAGE_ARG" ]; then
345349
PROGRAM_STORAGE="$PROGRAM_STORAGE_ARG"
346350
fi
347-
if [ -n "$URCAP_STORAGE_ARG" ]; then
351+
if [ -z "$URCAP_STORAGE_ARG" ]; then
348352
URCAP_STORAGE="$URCAP_STORAGE_ARG"
349353
fi
350354

0 commit comments

Comments
 (0)