Skip to content

Commit c72bb3e

Browse files
committed
Use urcl start_ursim from ur_bringup, as well
1 parent 8d373eb commit c72bb3e

File tree

1 file changed

+5
-91
lines changed

1 file changed

+5
-91
lines changed

ur_bringup/scripts/start_ursim.sh

Lines changed: 5 additions & 91 deletions
Original file line numberDiff line numberDiff line change
@@ -28,102 +28,16 @@
2828
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
2929
# POSSIBILITY OF SUCH DAMAGE.
3030

31-
PERSISTENT_BASE="${HOME}/.ursim"
32-
URCAP_VERSION="1.0.5"
3331

3432
echo -e "\033[0;31mDEPRECATION WARNING: " \
3533
"Launch files from the ur_bringup package are deprecated and will be removed from Iron " \
3634
"Irwini on. Please use the same launch files from the ur_robot_driver package." \
3735
"\033[0m"
3836

39-
help()
40-
{
41-
# Display Help
42-
echo "Starts URSim inside a docker container"
43-
echo
44-
echo "Syntax: `basename "$0"` [-m|s|h]"
45-
echo "options:"
46-
echo " -m <model> Robot model. One of [ur3, ur3e, ur5, ur5e, ur10, ur10e, ur16e]. Defaults to ur5e."
47-
echo " -h Print this Help."
48-
echo
49-
}
37+
ORANGE='\033[0;33m'
38+
NC='\033[0m' # No Color
5039

51-
ROBOT_MODEL=UR5
52-
ROBOT_SERIES=e-series
40+
URSIM_CMD="ros2 run ur_client_library start_ursim.sh"
5341

54-
validate_model()
55-
{
56-
case $ROBOT_MODEL in
57-
ur3|ur5|ur10)
58-
ROBOT_MODEL=${ROBOT_MODEL^^}
59-
ROBOT_SERIES=cb3
60-
;;
61-
ur3e|ur5e|ur10e|ur16e)
62-
ROBOT_MODEL=${ROBOT_MODEL^^}
63-
ROBOT_MODEL=$(echo ${ROBOT_MODEL:0:$((${#ROBOT_MODEL}-1))})
64-
ROBOT_SERIES=e-series
65-
;;
66-
*)
67-
echo "Not a valid robot model: $ROBOT_MODEL"
68-
exit
69-
;;
70-
esac
71-
}
72-
73-
74-
while getopts ":hm:s:" option; do
75-
case $option in
76-
h) # display Help
77-
help
78-
exit;;
79-
m) # robot model
80-
ROBOT_MODEL=${OPTARG}
81-
validate_model
82-
;;
83-
\?) # invalid option
84-
echo "Error: Invalid option"
85-
help
86-
exit;;
87-
esac
88-
done
89-
90-
URCAP_STORAGE="${PERSISTENT_BASE}/${ROBOT_SERIES}/urcaps"
91-
PROGRAM_STORAGE="${PERSISTENT_BASE}/${ROBOT_SERIES}/programs"
92-
93-
# Create local storage for programs and URCaps
94-
mkdir -p "${URCAP_STORAGE}"
95-
mkdir -p "${PROGRAM_STORAGE}"
96-
97-
# Download external_control URCap
98-
if [[ ! -f "${URCAP_STORAGE}/externalcontrol-${URCAP_VERSION}.jar" ]]; then
99-
curl -L -o "${URCAP_STORAGE}/externalcontrol-${URCAP_VERSION}.jar" \
100-
"https://github.com/UniversalRobots/Universal_Robots_ExternalControl_URCap/releases/download/v${URCAP_VERSION}/externalcontrol-${URCAP_VERSION}.jar"
101-
fi
102-
103-
# Check whether network already exists
104-
docker network inspect ursim_net > /dev/null
105-
if [ $? -eq 0 ]; then
106-
echo "ursim_net already exists"
107-
else
108-
echo "Creating ursim_net"
109-
docker network create --subnet=192.168.56.0/24 ursim_net
110-
fi
111-
112-
# run docker container
113-
docker run --rm -d --net ursim_net --ip 192.168.56.101\
114-
-v "${URCAP_STORAGE}":/urcaps \
115-
-v "${PROGRAM_STORAGE}":/ursim/programs \
116-
-e ROBOT_MODEL="${ROBOT_MODEL}" \
117-
--name ursim \
118-
universalrobots/ursim_${ROBOT_SERIES} || exit
119-
120-
trap "echo killing; docker container kill ursim; exit" SIGINT SIGTERM
121-
122-
echo "Docker URSim is running"
123-
printf "\nTo access Polyscope, open the following URL in a web browser.\n\thttp://192.168.56.101:6080/vnc.html\n\n"
124-
echo "To exit, press CTRL+C"
125-
126-
while :
127-
do
128-
sleep 1
129-
done
42+
echo -e "${ORANGE} DEPRECATION WARNING: The script starting URSim was moved to the ur_client_library package. This script here does still work, but will be removed with ROS Jazzy. Please use `${URSIM_CMD}` to start URSim in future."
43+
$URSIM_CMD

0 commit comments

Comments
 (0)