diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 9dfa8f5c3..99562ce4b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -19,6 +19,8 @@ jobs: run: git config --global --add safe.directory /__w/bitbots_meta/bitbots_meta - name: Pull our software run: make pull-init + - name: Install proprietary basler drivers + run: make basler ARGS="-ci" - name: Install packages via rosdep run: | rosdep update @@ -26,8 +28,6 @@ jobs: # Small hack to make rosdep install all dependencies at once # See https://github.com/ros-infrastructure/rosdep/issues/671 bash -c "sudo apt install -y $(rosdep check --from-paths . --ignore-src --rosdistro iron | sed -n 's/^apt\s\+//p' | tr '\n' ' ')" - - name: Ignore pylon camera because of proprietary drivers - run: touch lib/pylon-ros-camera/AMENT_IGNORE - name: Set up colcon workspace run: | mkdir -p /colcon_ws/src diff --git a/.gitignore b/.gitignore index 77daa15da..a69dc8169 100644 --- a/.gitignore +++ b/.gitignore @@ -6,7 +6,6 @@ ansible_robots/* doc_internal/* doku/* -basler_drivers/* human_pose_estimation_openvino/* # Exclude autogenerated documentation files diff --git a/Makefile b/Makefile index 98799269e..fb213110d 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ .PHONY : basler install pip pre-commit pull-all pull-init pull-files rosdep status update basler: - scripts/make_basler.sh + scripts/make_basler.sh $(ARGS) install: pull-init scripts/make_update.sh diff --git a/scripts/make_basler.sh b/scripts/make_basler.sh index 497966494..e4d7dcaad 100755 --- a/scripts/make_basler.sh +++ b/scripts/make_basler.sh @@ -1,8 +1,75 @@ -#!/bin/sh - -# Install Basler drivers -# Check if basler_drivers is already installed -# If not, clone the repository -# Run the setup script to install the drivers -test -d basler_drivers || git clone git@git.mafiasi.de:Bit-Bots/basler_drivers.git -cd basler_drivers && ./setup.sh +#!/bin/bash + +# You need to fill out a form to download the pylon driver. +# The pylon driver can be found in the download section of the following link: +# https://www.baslerweb.com/en/downloads/software-downloads/ +# Go to the download button and copy the link address. +PYLON_DOWNLOAD_URL="https://www2.baslerweb.com/media/downloads/software/pylon_software/pylon_7_4_0_14900_linux_x86_64_debs.tar.gz" +PYLON_VERSION="7.4.0" + +# Similar to the pylon driver we also need to download the blaze supplementary package. +BLAZE_DOWNLOAD_URL="https://www2.baslerweb.com/media/downloads/software/tof_software/pylon-supplementary-package-for-blaze-1.5.0.def07388_amd64.deb" +BLAZE_VERSION="1.5.0" + +# Check let the user confirm that they read the license agreement on the basler website and agree with it. +echo "You need to confirm that you read the license agreements for pylon $PYLON_VERSION and the blaze supplementary package $BLAZE_VERSION on the basler download page (https://www.baslerweb.com/en/downloads/software-downloads/) and agree with it." + +# Check -ci flag for automatic confirmation in the ci +if [[ $1 == "-ci" ]]; then + echo "Running in a CI environment, continuing..." +else + # Ask the user if they want to continue and break if they don't + read -p "Do you want to continue? [y/N] " -n 1 -r + + if [[ ! $REPLY =~ ^[Yy]$ ]]; then + echo "Aborting..." + exit 1 + fi +fi + +# Create function to check if we have an internet connection +function check_internet_connection () { + # Check if we have an internet connection, except in the ci as azure does not support ping by design + if [[ $1 != "-ci" ]] && ! ping -q -c 1 -W 1 google.com >/dev/null; then + echo "No internet connection. Please check your internet connection to install the basler drivers." + exit 1 + fi +} + +# Check if the correct pylon driver PYLON_VERSION is installed (apt) +if apt list pylon --installed | grep -q $PYLON_VERSION; then + echo "Pylon driver $PYLON_VERSION is already installed." +else + echo "Pylon driver $PYLON_VERSION is not installed. Installing..." + # Check if we have an internet connection + check_internet_connection $1 + # Check if the url exist + if ! curl --output /dev/null --silent --head --fail "$PYLON_DOWNLOAD_URL"; then + echo "Pylon download url does not exist. Please check the url and update the 'PYLON_DOWNLOAD_URL' variable in the 'make_basler.sh' script. The website might have changed." + exit 1 + fi + # Download the pylon driver to temp folder + wget --no-verbose --show-progress $PYLON_DOWNLOAD_URL -O /tmp/pylon_${PYLON_VERSION}.tar.gz + # Extract the pylon driver + tar -xzf /tmp/pylon_${PYLON_VERSION}.tar.gz -C /tmp + # Install the pylon driver + sudo apt install /tmp/pylon_${PYLON_VERSION}*.deb -y +fi + +# Check if the correct blaze supplementary package BLAZE_VERSION is installed (apt) +if apt list pylon-supplementary-package-for-blaze --installed | grep -q $BLAZE_VERSION; then + echo "Blaze supplementary package $BLAZE_VERSION is already installed." +else + echo "Blaze supplementary package $BLAZE_VERSION is not installed. Installing..." + # Check if we have an internet connection + check_internet_connection $1 + # Check if the url exist + if ! curl --output /dev/null --silent --head --fail "$BLAZE_DOWNLOAD_URL"; then + echo "Blaze download url does not exist. Please check the url and update the 'BLAZE_DOWNLOAD_URL' variable in the 'make_basler.sh' script. The website might have changed." + exit 1 + fi + # Download the blaze supplementary package to temp folder + wget --no-verbose --show-progress $BLAZE_DOWNLOAD_URL -O /tmp/pylon-blaze-supplementary-package_${BLAZE_VERSION}.deb + # Install the blaze supplementary package + sudo apt install /tmp/pylon-blaze-supplementary-package_${BLAZE_VERSION}*.deb -y +fi diff --git a/scripts/pull_all.sh b/scripts/pull_all.sh index 13d13cc46..ffc8d850d 100755 --- a/scripts/pull_all.sh +++ b/scripts/pull_all.sh @@ -3,8 +3,3 @@ set -e git submodule foreach git pull git -C humanoid_league_misc submodule update -if [[ -d basler_drivers ]]; then - git -C basler_drivers pull -else - echo -e "\n\n\033[91m\033[1mNo basler drivers found! Use 'make basler' to install them and restart this script afterwards\033[0m\n" -fi diff --git a/sync_includes_wolfgang_nuc.yaml b/sync_includes_wolfgang_nuc.yaml index 5cc71cad6..d3824af06 100644 --- a/sync_includes_wolfgang_nuc.yaml +++ b/sync_includes_wolfgang_nuc.yaml @@ -1,5 +1,4 @@ include: - - basler_drivers - bitbots_behavior: - bitbots_blackboard - bitbots_body_behavior