Skip to content

Commit 4d2748b

Browse files
author
Felix Exner
committed
Allow detached mode for start_ursim.sh
1 parent a9de3f5 commit 4d2748b

File tree

3 files changed

+17
-8
lines changed

3 files changed

+17
-8
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525
- uses: actions/checkout@v1
2626
- name: start ursim
2727
run: |
28-
scripts/start_ursim.sh -m $ROBOT_MODEL -v $URSIM_VERSION -p $PROGRAM_FOLDER
28+
scripts/start_ursim.sh -m $ROBOT_MODEL -v $URSIM_VERSION -p $PROGRAM_FOLDER -d
2929
env: ${{matrix.env}}
3030
- name: install gtest
3131
run: sudo apt-get install -y libgtest-dev

.github/workflows/industrial-ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ jobs:
8383
- uses: actions/checkout@v1
8484
- name: start ursim
8585
run: |
86-
scripts/start_ursim.sh -m $ROBOT_MODEL -v $URSIM_VERSION -p $PROGRAM_FOLDER
86+
scripts/start_ursim.sh -m $ROBOT_MODEL -v $URSIM_VERSION -p $PROGRAM_FOLDER -d
8787
env: ${{matrix.env}}
8888
- uses: 'ros-industrial/industrial_ci@master'
8989
env: ${{matrix.env}}

scripts/start_ursim.sh

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ help()
4545
If not specified, will fallback to ${PERSISTENT_BASE}/${ROBOT_SERIES}/programs"
4646
echo " -u <folder> Location from which URCaps are read / to which URCaps are written.
4747
If not specified, will fallback to ${PERSISTENT_BASE}/${ROBOT_SERIES}/urcaps"
48+
echo " -d Detached mode - start in backgound"
4849
echo " -h Print this Help."
4950
echo
5051
}
@@ -54,6 +55,7 @@ ROBOT_SERIES=e-series
5455
URSIM_VERSION=latest
5556
URCAP_STORAGE="${PERSISTENT_BASE}/${ROBOT_SERIES}/urcaps"
5657
PROGRAM_STORAGE="${PERSISTENT_BASE}/${ROBOT_SERIES}/programs"
58+
DETACHED=false
5759

5860

5961
validate_model()
@@ -101,7 +103,7 @@ validate_ursim_version()
101103
}
102104

103105

104-
while getopts ":hm:v:p:u:" option; do
106+
while getopts ":hm:v:p:u:d" option; do
105107
case $option in
106108
h) # display Help
107109
help
@@ -120,6 +122,9 @@ while getopts ":hm:v:p:u:" option; do
120122
u) # urcaps_folder
121123
URCAP_STORAGE=${OPTARG}
122124
;;
125+
d) # detached mode
126+
DETACHED=true
127+
;;
123128
\?) # invalid option
124129
echo "Error: Invalid option"
125130
help
@@ -155,9 +160,13 @@ trap "echo killing; docker container kill ursim; exit" SIGINT SIGTERM
155160

156161
echo "Docker URSim is running"
157162
printf "\nTo access Polyscope, open the following URL in a web browser.\n\thttp://192.168.56.101:6080/vnc.html\n\n"
158-
echo "To exit, press CTRL+C"
159163

160-
while :
161-
do
162-
sleep 1
163-
done
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)