Skip to content

Commit

Permalink
Fix balser driver and make setup easier (#209)
Browse files Browse the repository at this point in the history
  • Loading branch information
jaagut authored Oct 26, 2023
2 parents d14c2c3 + bf0e519 commit 66c0b06
Show file tree
Hide file tree
Showing 6 changed files with 78 additions and 18 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@ 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
sudo apt install -y libunwind-dev
# 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
Expand Down
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
ansible_robots/*
doc_internal/*
doku/*
basler_drivers/*
human_pose_estimation_openvino/*

# Exclude autogenerated documentation files
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -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
Expand Down
83 changes: 75 additions & 8 deletions scripts/make_basler.sh
Original file line number Diff line number Diff line change
@@ -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 [email protected]: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
5 changes: 0 additions & 5 deletions scripts/pull_all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
1 change: 0 additions & 1 deletion sync_includes_wolfgang_nuc.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
include:
- basler_drivers
- bitbots_behavior:
- bitbots_blackboard
- bitbots_body_behavior
Expand Down

0 comments on commit 66c0b06

Please sign in to comment.