From a8ea2c343b43a7ffb6e758fe4dec82dc42951051 Mon Sep 17 00:00:00 2001 From: Felix Exner Date: Thu, 6 Jul 2023 04:27:43 +0000 Subject: [PATCH 1/2] Forward start_ursim.sh to the one from the client library --- ur_robot_driver/scripts/start_ursim.sh | 97 ++------------------------ 1 file changed, 5 insertions(+), 92 deletions(-) diff --git a/ur_robot_driver/scripts/start_ursim.sh b/ur_robot_driver/scripts/start_ursim.sh index a8f717898..94e9b1e5a 100755 --- a/ur_robot_driver/scripts/start_ursim.sh +++ b/ur_robot_driver/scripts/start_ursim.sh @@ -28,97 +28,10 @@ # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE # POSSIBILITY OF SUCH DAMAGE. -PERSISTENT_BASE="${HOME}/.ursim" -URCAP_VERSION="1.0.5" +ORANGE='\033[0;33m' +NC='\033[0m' # No Color -help() -{ - # Display Help - echo "Starts URSim inside a docker container" - echo - echo "Syntax: `basename "$0"` [-m|s|h]" - echo "options:" - echo " -m Robot model. One of [ur3, ur3e, ur5, ur5e, ur10, ur10e, ur16e]. Defaults to ur5e." - echo " -h Print this Help." - echo -} +URSIM_CMD="ros2 run ur_client_library start_ursim.sh" -ROBOT_MODEL=UR5 -ROBOT_SERIES=e-series - -validate_model() -{ - case $ROBOT_MODEL in - ur3|ur5|ur10) - ROBOT_MODEL=${ROBOT_MODEL^^} - ROBOT_SERIES=cb3 - ;; - ur3e|ur5e|ur10e|ur16e) - ROBOT_MODEL=${ROBOT_MODEL^^} - ROBOT_MODEL=$(echo ${ROBOT_MODEL:0:$((${#ROBOT_MODEL}-1))}) - ROBOT_SERIES=e-series - ;; - *) - echo "Not a valid robot model: $ROBOT_MODEL" - exit - ;; - esac -} - - -while getopts ":hm:s:" option; do - case $option in - h) # display Help - help - exit;; - m) # robot model - ROBOT_MODEL=${OPTARG} - validate_model - ;; - \?) # invalid option - echo "Error: Invalid option" - help - exit;; - esac -done - -URCAP_STORAGE="${PERSISTENT_BASE}/${ROBOT_SERIES}/urcaps" -PROGRAM_STORAGE="${PERSISTENT_BASE}/${ROBOT_SERIES}/programs" - -# Create local storage for programs and URCaps -mkdir -p "${URCAP_STORAGE}" -mkdir -p "${PROGRAM_STORAGE}" - -# Download external_control URCap -if [[ ! -f "${URCAP_STORAGE}/externalcontrol-${URCAP_VERSION}.jar" ]]; then - curl -L -o "${URCAP_STORAGE}/externalcontrol-${URCAP_VERSION}.jar" \ - "https://github.com/UniversalRobots/Universal_Robots_ExternalControl_URCap/releases/download/v${URCAP_VERSION}/externalcontrol-${URCAP_VERSION}.jar" -fi - -# Check whether network already exists -docker network inspect ursim_net > /dev/null -if [ $? -eq 0 ]; then - echo "ursim_net already exists" -else - echo "Creating ursim_net" - docker network create --subnet=192.168.56.0/24 ursim_net -fi - -# run docker container -docker run --rm -d --net ursim_net --ip 192.168.56.101\ - -v "${URCAP_STORAGE}":/urcaps \ - -v "${PROGRAM_STORAGE}":/ursim/programs \ - -e ROBOT_MODEL="${ROBOT_MODEL}" \ - --name ursim \ - universalrobots/ursim_${ROBOT_SERIES} || exit - -trap "echo killing; docker container kill ursim; exit" SIGINT SIGTERM - -echo "Docker URSim is running" -printf "\nTo access Polyscope, open the following URL in a web browser.\n\thttp://192.168.56.101:6080/vnc.html\n\n" -echo "To exit, press CTRL+C" - -while : -do - sleep 1 -done +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." +$URSIM_CMD From 5fcc30443112b3aae7073a4df9ef60cb6532375d Mon Sep 17 00:00:00 2001 From: Felix Exner Date: Fri, 14 Jul 2023 08:45:46 +0200 Subject: [PATCH 2/2] Update docs and tests to start ursim from the ur_client_library script --- ur_robot_driver/doc/installation/ursim_docker.rst | 4 ++-- ur_robot_driver/doc/usage.rst | 2 +- ur_robot_driver/test/dashboard_client.py | 4 ++-- ur_robot_driver/test/robot_driver.py | 7 ++++++- ur_robot_driver/test/urscript_interface.py | 4 ++-- 5 files changed, 13 insertions(+), 8 deletions(-) diff --git a/ur_robot_driver/doc/installation/ursim_docker.rst b/ur_robot_driver/doc/installation/ursim_docker.rst index e113942e1..855ff062b 100644 --- a/ur_robot_driver/doc/installation/ursim_docker.rst +++ b/ur_robot_driver/doc/installation/ursim_docker.rst @@ -82,11 +82,11 @@ address. The VNC web server will be available at ` + ros2 run ur_client_library start_ursim.sh -m With this, we can spin up a driver using diff --git a/ur_robot_driver/test/dashboard_client.py b/ur_robot_driver/test/dashboard_client.py index 917189c72..056a04d67 100755 --- a/ur_robot_driver/test/dashboard_client.py +++ b/ur_robot_driver/test/dashboard_client.py @@ -89,9 +89,9 @@ def generate_test_description(): cmd=[ PathJoinSubstitution( [ - FindPackagePrefix("ur_robot_driver"), + FindPackagePrefix("ur_client_library"), "lib", - "ur_robot_driver", + "ur_client_library", "start_ursim.sh", ] ), diff --git a/ur_robot_driver/test/robot_driver.py b/ur_robot_driver/test/robot_driver.py index 4dfc91404..27792c0a5 100755 --- a/ur_robot_driver/test/robot_driver.py +++ b/ur_robot_driver/test/robot_driver.py @@ -107,7 +107,12 @@ def generate_test_description(): ursim = ExecuteProcess( cmd=[ PathJoinSubstitution( - [FindPackagePrefix("ur_robot_driver"), "lib", "ur_robot_driver", "start_ursim.sh"] + [ + FindPackagePrefix("ur_client_library"), + "lib", + "ur_client_library", + "start_ursim.sh", + ] ), " ", "-m ", diff --git a/ur_robot_driver/test/urscript_interface.py b/ur_robot_driver/test/urscript_interface.py index 461d04699..1a303a7a1 100755 --- a/ur_robot_driver/test/urscript_interface.py +++ b/ur_robot_driver/test/urscript_interface.py @@ -103,9 +103,9 @@ def generate_test_description(): cmd=[ PathJoinSubstitution( [ - FindPackagePrefix("ur_robot_driver"), + FindPackagePrefix("ur_client_library"), "lib", - "ur_robot_driver", + "ur_client_library", "start_ursim.sh", ] ),