From ff3ce2190696b5b738f2c3d675d37ecfd6e8a2ba Mon Sep 17 00:00:00 2001 From: "Felix Exner (fexner)" Date: Thu, 10 Oct 2024 11:55:02 +0200 Subject: [PATCH] Readme update hosted docs (#1137) * Update doc links from README to use separate doc * Add a URL check to CI This way we should find our earlier if a link breaks. * Update link check to have ignore patterns * Fix array handling --- .github/helpers/check_urls.sh | 67 +++++++++++++++++++++++++++++++ .github/workflows/check_links.yml | 19 +++++++++ README.md | 18 ++++----- 3 files changed, 95 insertions(+), 9 deletions(-) create mode 100755 .github/helpers/check_urls.sh create mode 100644 .github/workflows/check_links.yml diff --git a/.github/helpers/check_urls.sh b/.github/helpers/check_urls.sh new file mode 100755 index 000000000..f7222d115 --- /dev/null +++ b/.github/helpers/check_urls.sh @@ -0,0 +1,67 @@ +#!/bin/bash + +set -e + +IGNORE_FILES="" +IGNORE_PATTERNS="" + +while getopts ":f:d:p:" opt; do + case "${opt}" in + f) + IGNORE_FILES="${OPTARG}";; + d) + IGNORE_DIRS="${OPTARG}";; + p) + IGNORE_PATTERNS="${OPTARG}";; + \?) + echo "Invalid option -$OPTARG" + exit;; + esac +done + +read -r -a ignore_files <<<"$IGNORE_FILES" +read -r -a ignore_dirs <<<"$IGNORE_DIRS" +read -r -a ignore_patterns <<<"$IGNORE_PATTERNS" + +IGNORE_FILES_ARG="" +for item in "${ignore_files[@]}"; do + IGNORE_FILES_ARG="$IGNORE_FILES_ARG --exclude=$item" +done +IGNORE_DIRS_ARG="" +for item in "${ignore_dirs[@]}"; do + IGNORE_DIRS_ARG="$IGNORE_DIRS_ARG --exclude-dir=$item" +done + +#Find URLs in code: +urls=$(grep -oP '(http|ftp|https):\/\/([a-zA-Z0-9_-]+(?:(?:\.[a-zA-Z0-9_-]+)+))([a-zA-Z0-9_.,@?^=%&:\/~+#-]*[a-zA-Z0-9_@?^=%&\/~+#-])?' -rI $IGNORE_FILES_ARG $IGNORE_DIRS_ARG) + +fail_counter=0 + +FAILED_LINKS=() +for item in $urls; do +# echo $item + skip=0 + for pattern in "${ignore_patterns[@]}"; do + [[ "$item" =~ $pattern ]] && skip=1 + done + + if [[ $skip == 1 ]]; then + echo "SKIPPING $item" + continue + fi + + filename=$(echo "$item" | cut -d':' -f1) + url=$(echo "$item" | cut -d':' -f2-) + echo -n "Checking $url from file $filename" + if ! curl --head --silent --fail "$url" 2>&1 > /dev/null; then + echo -e " \033[0;31mNOT FOUND\033[32m\n" + FAILED_LINKS+=("$url from file $filename") + ((fail_counter=fail_counter+1)) + else + printf " \033[32mok\033[0m\n" + fi +done + +echo "Failed files:" +printf '%s\n' "${FAILED_LINKS[@]}" +exit $fail_counter diff --git a/.github/workflows/check_links.yml b/.github/workflows/check_links.yml new file mode 100644 index 000000000..ba1800e00 --- /dev/null +++ b/.github/workflows/check_links.yml @@ -0,0 +1,19 @@ +name: Check Links +on: + workflow_dispatch: + pull_request: + push: + branches: + - main + +jobs: + check_links: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Check URLs + run: | + .github/helpers/check_urls.sh \ + -d ".git build CMakeModules debian" \ + -f "package.xml ursim_docker.rst" \ + -p "vnc\.html" diff --git a/README.md b/README.md index 2413a2f11..5888b857f 100644 --- a/README.md +++ b/README.md @@ -103,24 +103,24 @@ For getting started, you'll basically need three steps: ```bash sudo apt-get install ros-rolling-ur ``` - See the [installation instructions](https://docs.ros.org/en/ros2_packages/rolling/api/ur_robot_driver/installation/installation.html) for more details and source-build instructions. + See the [installation instructions](https://docs.universal-robots.com/Universal_Robots_ROS2_Documentation/doc/ur_robot_driver/ur_robot_driver/doc/installation/installation.html) for more details and source-build instructions. 2. **Start & Setup the robot**. Once you've installed the driver, [setup the - robot](https://docs.ros.org/en/ros2_packages/rolling/api/ur_robot_driver/installation/robot_setup.html) + robot](https://docs.universal-robots.com/Universal_Robots_ROS2_Documentation/doc/ur_robot_driver/ur_robot_driver/doc/installation/robot_setup.html) and [create a program for external - control](https://docs.ros.org/en/ros2_packages/rolling/api/ur_robot_driver/installation/install_urcap_e_series.html). + control](https://docs.universal-robots.com/Universal_Robots_ROS2_Documentation/doc/ur_robot_driver/ur_robot_driver/doc/installation/install_urcap_e_series.html). Please do this step carefully and extract the calibration as explained - [here](https://docs.ros.org/en/ros2_packages/rolling/api/ur_robot_driver/installation/robot_setup.html#extract-calibration-information). + [here](https://docs.universal-robots.com/Universal_Robots_ROS2_Documentation/doc/ur_robot_driver/ur_robot_driver/doc/installation/robot_setup.html#extract-calibration-information). Otherwise the TCP's pose will not be correct inside the ROS ecosystem. If no real robot is required, you can [use a simulated - robot](https://docs.ros.org/en/ros2_packages/rolling/api/ur_robot_driver/usage.html#usage-with-official-ur-simulator) + robot](https://docs.universal-robots.com/Universal_Robots_ROS2_Documentation/doc/ur_robot_driver/ur_robot_driver/doc/usage/simulation.html#usage-with-official-ur-simulator) that will behave almost exactly like the real robot. 3. **Start the driver**. See the [usage - documentation](https://docs.ros.org/en/ros2_packages/rolling/api/ur_robot_driver/usage.html) for + documentation](https://docs.universal-robots.com/Universal_Robots_ROS2_Documentation/doc/ur_robot_driver/ur_robot_driver/doc/usage/toc.html) for details. ```bash @@ -129,7 +129,7 @@ For getting started, you'll basically need three steps: ros2 launch ur_robot_driver ur_control.launch.py ur_type:=ur5e robot_ip:=192.168.56.101 ``` -4. Unless started in [headless mode](https://docs.ros.org/en/ros2_packages/rolling/api/ur_robot_driver/ROS_INTERFACE.html#headless-mode): Run the external_control program by **pressing `play` on the teach pendant**. +4. Unless started in [headless mode](https://docs.universal-robots.com/Universal_Robots_ROS2_Documentation/doc/ur_robot_driver/ur_robot_driver/doc/operation_modes.html#headless-mode): Run the external_control program by **pressing `play` on the teach pendant**. ## MoveIt! support @@ -142,9 +142,9 @@ Watch MoveIt in action with the Universal Robots ROS2 driver: *The video shows free-space trajectory planning around a modeled collision scene object using the MoveIt2 MotionPlanning widget for Rviz2.* See the [MoveIt! -section](https://docs.ros.org/en/ros2_packages/rolling/api/ur_robot_driver/usage.html#using-moveit) +section](https://docs.universal-robots.com/Universal_Robots_ROS2_Documentation/doc/ur_robot_driver/ur_robot_driver/doc/usage/move.html#using-moveit) of the [Usage -guide](https://docs.ros.org/en/ros2_packages/rolling/api/ur_robot_driver/usage.html) for details. +guide](https://docs.universal-robots.com/Universal_Robots_ROS2_Documentation/doc/ur_robot_driver/ur_robot_driver/doc/usage/toc.html) for details. ## Expected Changes in the Near Future