Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 13 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,17 @@ All code is written as individual ROS 2 packages.

The workspace is managed using the [pixi](https://pixi.sh) package manager. This allows us to have reproducible builds and easy user space dependency management similar to tools like `uv` or `cargo`. This also means that no system wide ROS installation or superuser privileges are required to install or run the code.

Full step-by-step instructions for installing the Bit-Bots software stack and ROS 2 can be found in our documentation [here](https://docs.bit-bots.de/meta/manual/tutorials/install_software_ros2.html).
Full step-by-step instructions for installing the Bit-Bots software stack and ROS 2 can be found in our [documentation](https://docs.bit-bots.de/meta/manual/tutorials/install_software_ros2.html).

Run the following command inside this repository to build the workspace. All dependencies will be installed automatically. Make sure you have [pixi](https://pixi.sh) installed. A few optional proprietary dependencies will be needed for full functionality, see the documentation for details.
Run the following command inside this repository to build the workspace.
All dependencies will be installed automatically.
Make sure you have [pixi](https://pixi.sh) installed.
A few optional proprietary dependencies will be needed for full functionality, see the documentation for details.

``` shell
pixi run build
```

The first build will take a while as all dependencies are built from source.
Subsequent builds will be much faster.
The first build might fail due to missing dependencies.
Run `pixi run basler` to install the Basler pylon camera driver.

Expand All @@ -42,7 +43,13 @@ alternatively, you can run individual commands inside the workspace without acti
pixi run <command>
```

To see some predefined / commands, run
To build the workspace, run the following command in the terminal:

``` shell
pixi run build
```

To see some predefined tasks / commands, run

``` shell
pixi task list
Expand All @@ -53,7 +60,7 @@ pixi task list
To deploy the software to a robot, run

``` shell
pixi run deploy <robot_ip|robot_name>
pixi run deploy
Comment thread
jaagut marked this conversation as resolved.
```

For more information on the deployment tooling, see [this documentation](scripts/README.md).
Expand Down
8 changes: 4 additions & 4 deletions scripts/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ This tool is also callable via `pixi run deploy <arguments>`.

Deploy, configure, and launch the Bit-Bots software remotely on a robot.
This tool can target all, multiple, or single robots at once, specified by their hostname, robot name, or IP address.
Five different tasks can be performed:
These different tasks can be performed:

1. Synchronize the local source code to the target workspace
3. Configure game-settings and wifi on the target
4. Build (compile) the workspace on the target
5. Launch the teamplayer software on the target
2. Configure game-settings and wifi on the target
3. Build (compile) the workspace on the target
4. Launch the teamplayer software on the target
Comment thread
jaagut marked this conversation as resolved.

### Example usage

Expand Down
114 changes: 84 additions & 30 deletions scripts/make_basler.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,52 +8,106 @@ set -eEo pipefail
PYLON_DOWNLOAD_URL="https://data.bit-bots.de/pylon_7_4_0_14900_linux_x86_64_debs.tar.gz.gpg"
Comment thread
jaagut marked this conversation as resolved.
PYLON_VERSION="7.4.0"

CI=false
SKIP_OS_CHECK=false
SHOW_PROGRESS="--show-progress"
UNKNOWN_ARGS=()

print_help() {
echo "Usage: $0 [--ci] [--skip-os-check] [--help]"
echo
echo " --ci Run non-interactively for CI (skips confirmation and progress)"
echo " --skip-os-check Skip the Ubuntu version/OS check"
echo " -h, --help Show this help message and exit"
}

# Parse arguments position-independently
for arg in "$@"; do
case "$arg" in
--ci)
CI=true
SHOW_PROGRESS=""
;;
--skip-os-check)
SKIP_OS_CHECK=true
;;
-h|--help)
print_help
exit 0
;;
*)
UNKNOWN_ARGS+=("$arg")
;;
esac
done

# If unknown arguments were passed, warn and show help
if [[ ${#UNKNOWN_ARGS[@]} -gt 0 ]]; then
echo "Unknown argument(s): ${UNKNOWN_ARGS[*]}"
echo
print_help
exit 1
fi

# 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 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..."
SHOW_PROGRESS=""
else
# Ask the user if they want to continue and break if they don't
# If not running in CI, ask the user to confirm license agreement
if [[ "$CI" != true ]]; then
read -p "Do you want to continue? [y/N] " -n 1 -r

echo
if [[ ! $REPLY =~ ^[Yy]$ ]]; then
echo "Aborting..."
exit 1
fi
SHOW_PROGRESS="--show-progress"
fi

check_os_is_required_ubuntu_version () {
# Check if the OS is ubuntu
echo "Checking for compatible OS..."
if [[ "$(lsb_release -is)" != "Ubuntu" ]]; then
echo "This driver package only supports Ubuntu (and some Debian derivatives)."
echo "Please install Ubuntu >= 18.04 and try again OR try it on a compatible Debian derivative with --skip-os-check."
exit 1
fi
}

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
if [[ "$CI" != true ]] && ! 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
# Check if the correct pylon driver PYLON_VERSION is installed (use dpkg-query)
INSTALLED_VERSION=$(dpkg-query -W -f='${Version}' pylon 2>/dev/null || true)
if [[ -n "$INSTALLED_VERSION" && "$INSTALLED_VERSION" == *"$PYLON_VERSION"* ]]; then
echo "Pylon driver $PYLON_VERSION is already installed."
exit 0
fi

echo "Pylon driver $PYLON_VERSION is not installed. Installing..."
# Check if the OS is the required ubuntu version
if [[ "$SKIP_OS_CHECK" != true ]]; then
check_os_is_required_ubuntu_version
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.gpg
# Extract the pylon driver
mkdir -p /tmp/pylon
# Decrypt the pylon driver
gpg --batch --yes --passphrase "12987318371043223" -o /tmp/pylon_${PYLON_VERSION}.tar.gz -d /tmp/pylon_${PYLON_VERSION}.tar.gz.gpg
# Extract the pylon driver
tar -xzf /tmp/pylon_${PYLON_VERSION}.tar.gz -C /tmp/pylon/
# Install the pylon driver
sudo apt-get install /tmp/pylon/pylon_${PYLON_VERSION}*.deb -y
echo "Skipping OS check."
fi

# Check if we have an internet connection
check_internet_connection
# 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.gpg
# Extract the pylon driver
mkdir -p /tmp/pylon
# Decrypt the pylon driver
gpg --batch --yes --passphrase "12987318371043223" -o /tmp/pylon_${PYLON_VERSION}.tar.gz -d /tmp/pylon_${PYLON_VERSION}.tar.gz.gpg
# Extract the pylon driver
tar -xzf /tmp/pylon_${PYLON_VERSION}.tar.gz -C /tmp/pylon/
# Install the pylon driver
sudo apt-get install /tmp/pylon/pylon_${PYLON_VERSION}*.deb -y
51 changes: 38 additions & 13 deletions scripts/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ set -eEuo pipefail
# static/global variables
DIR="$(dirname "$(readlink -f "$0")")"
BRANCH="${1:-main}"
REPO_URL="git@github.com:bit-bots/bitbots_main.git"
REPO_URL_SSH="git@github.com:bit-bots/bitbots_main.git"
REPO_URL_HTTPS="https://github.com/bit-bots/bitbots_main.git"

ask_question() {
while true; do
Expand All @@ -19,40 +20,62 @@ ask_question() {
}

setup_pixi() {
curl -fsSL https://pixi.sh/install.sh | sh
if ! type pixi &> /dev/null; then
curl -fsSL https://pixi.sh/install.sh | sh
export PATH="$PATH:$HOME/.pixi/bin"
fi
}

setup_repo() {
echo "Setting up bitbots_main repository..."

if (( in_repo )); then
cd "$meta_dir" || exit
cd "$main_dir" || exit
git checkout "$BRANCH"
else
if [[ ! -d "$PWD/bitbots_main" ]]; then
git clone "$REPO_URL"
echo "Cloning repository bitbots_main..."
# Try to clone via SSH first. If it fails, warn and ask user how to proceed.
if ! git clone "$REPO_URL_SSH"; then
Comment thread
jaagut marked this conversation as resolved.
echo "SSH clone failed. This may mean your SSH keys are not set up for GitHub."
echo "See: https://docs.github.com/en/authentication/connecting-to-github-with-ssh"
if ask_question "Do you want to continue with an HTTPS clone instead of fixing SSH keys now?"; then
echo "Cloning via HTTPS..."
git clone "$REPO_URL_HTTPS"
else
echo "Please set up your SSH keys and re-run this script. Exiting."
exit 1
fi
fi
git checkout "$BRANCH"
fi

meta_dir="$(realpath "$PWD/bitbots_main")"
cd "$meta_dir" || exit
main_dir="$(realpath "$PWD/bitbots_main")"
cd "$main_dir" || exit
fi

echo "Installing dependencies..."
$HOME/.pixi/bin/pixi install
install
}

setup_host() {
echo "Setting up system dependencies not covered by pixi. This may require sudo rights. For non-Ubuntu systems, please install the required packages manually."
if (( has_sudo )); then
$meta_dir/scripts/make_basler.sh
$main_dir/scripts/make_basler.sh
basler_installed=1
fi
}

build_repository() {
echo "Running full colcon build..."
echo "Running full build..."
set +u
$HOME/.pixi/bin/pixi run build

# Append "--packages-skip bitbots_basler_camera" to the build command if setup_host was skipped or failed
if (( basler_installed )); then
pixi run build
else
pixi run build --packages-skip bitbots_basler_camera
fi
}

has_sudo=0
Expand All @@ -63,13 +86,15 @@ if (( ! has_sudo )); then
echo "Because, you don't have sudo rights, no host dependencies will be installed."
Comment thread
jaagut marked this conversation as resolved.
fi

basler_installed=0

in_repo=1
meta_dir="$(realpath "$DIR/../")"
if [[ ! -d "$meta_dir/.git" ]]; then
main_dir="$(realpath "$DIR/../")"
if [[ ! -d "$main_dir/.git" ]]; then
in_repo=0
fi

setup_ros
setup_pixi
setup_repo
setup_host
build_repository
6 changes: 3 additions & 3 deletions src/bitbots_misc/bitbots_docs/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ find_package(ament_cmake REQUIRED)
# then, we can't build the documentation in this package
file(COPY files DESTINATION ${CMAKE_INSTALL_PREFIX}/share/${PROJECT_NAME})

# we cannot use the compiled catkin package of bitbots_docs since that would
# require this package to depend on itself. therefore we need to compile the sub
# cmake file ourselves and include it manually
# we cannot use the compiled package of bitbots_docs since that would require
# this package to depend on itself. therefore we need to compile the sub cmake
# file ourselves and include it manually
configure_file(cmake/enable_bitbots_docs.cmake.in
${CMAKE_BINARY_DIR}/enable_bitbots_docs.cmake @ONLY)
include(${CMAKE_BINARY_DIR}/enable_bitbots_docs.cmake)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
function(enable_bitbots_docs)
# create directories neccessary for sphinx
# create directories necessary for sphinx
file(MAKE_DIRECTORY ${CMAKE_SOURCE_DIR}/docs/_build/doxyoutput)
file(COPY @CMAKE_INSTALL_PREFIX@/share/bitbots_docs/files/_static DESTINATION ${CMAKE_SOURCE_DIR}/docs)

Expand Down
59 changes: 0 additions & 59 deletions src/bitbots_misc/bitbots_docs/docs/_static/bitbots_cpp_style.xml

This file was deleted.

This file was deleted.

Loading
Loading