Install error colors and script updates (#3614)
Some checks failed
Issues due date / Add labels to issues (push) Has been cancelled
Doxygen / build (push) Has been cancelled

* add colors and headers to installation scripts

* Try gazebo11 first, fall back to gazebo package if unavailable.
Show info message to user when fallback is triggered.

* Fix for install buttons.

* Fix: missing dronecan module on normal make, make clean unifiedmocap

---------

Co-authored-by: robinferede <robinferede@tudelft.nl>
This commit is contained in:
Christophe De Wagter
2026-03-06 16:33:13 +01:00
committed by GitHub
parent 15accba262
commit bc6cac516f
4 changed files with 145 additions and 17 deletions

View File

@@ -1,11 +1,59 @@
#!/bin/bash
# ── Color definitions ─────────────────────────────────────────────────────────
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
CYAN='\033[0;36m'
BOLD='\033[1m'
NC='\033[0m' # No Color
USE_VENV=true
BASHRC_SOURCE_VENV=false
# exit on error
# ── Helper functions ──────────────────────────────────────────────────────────
print_header() {
echo ""
echo -e "${CYAN}${BOLD}════════════════════════════════════════════════════════════════════════════════${NC}"
echo -e "${CYAN}${BOLD} $1${NC}"
echo -e "${CYAN}${BOLD}════════════════════════════════════════════════════════════════════════════════${NC}"
echo ""
}
print_success() {
echo ""
echo -e "${GREEN}${BOLD}$1${NC}"
echo ""
}
print_error() {
echo ""
echo -e "${RED}${BOLD}$1${NC}"
echo -e "${RED} Please check the error above and consult the documentation:${NC}"
echo -e "${RED} https://paparazzi-uav.readthedocs.io${NC}"
echo ""
}
run_step() {
# Usage: run_step "description" command arg1 arg2 ...
local description="$1"
shift
echo -e " ${YELLOW}${NC} ${description}..."
if "$@"; then
echo -e " ${GREEN}${NC} ${description} ${GREEN}done${NC}"
return 0
else
print_error "${description} FAILED"
return 1
fi
}
# Stop on error
set -e
# ── Parse arguments ───────────────────────────────────────────────────────────
for arg in "$@"
do
if [ "$arg" = "-h" ] || [ "$arg" = "--help" ]
@@ -20,7 +68,7 @@ do
if [ "$arg" = "-n" ] || [ "$arg" = "--no-venv" ]
then
USE_VENV=false
echo "the venv will not be installed!"
echo -e "${YELLOW} ⚠ Virtual environment will NOT be installed.${NC}"
fi
if [ "$arg" = "-s" ] || [ "$arg" = "--source" ]
@@ -33,31 +81,55 @@ done
if [ $VIRTUAL_ENV ]
then
echo "Cannot create venv from itself! Run 'deactivate' first if you want to recreate the venv."
echo -e "${YELLOW}Cannot create venv from itself! Run 'deactivate' first if you want to recreate the venv.${NC}"
USE_VENV = false
BASHRC_SOURCE_VENV=false
fi
# ── Install Qt dependencies ──────────────────────────────────────────────────
print_header "Step 1/3 — Installing Qt platform dependencies"
# Solves: Could not load the Qt platform plugin "xcb"
sudo apt install libxcb-xinerama0 libxcb-cursor0 libxkbcommon-x11-0 libglu1-mesa
if run_step "Installing Qt libraries" sudo apt install -y libxcb-xinerama0 libxcb-cursor0 libxkbcommon-x11-0 libglu1-mesa; then
print_success "Qt dependencies installed successfully"
else
exit 1
fi
# ── Set up Python environment ────────────────────────────────────────────────
print_header "Step 2/3 — Setting up Python environment"
if [ "$USE_VENV" = true ]
then
sudo apt install -y python3 python3-venv
python3 setup.py
run_step "Installing python3 and python3-venv" sudo apt install -y python3 python3-venv
run_step "Creating virtual environment" python3 setup.py
source pprzEnv/bin/activate
print_success "Virtual environment created and activated"
if [ "$BASHRC_SOURCE_VENV" = true ]
then
echo "venv source will be added to ~/.bashrc"
echo "source $(pwd)/pprzEnv/bin/activate" >> ~/.bashrc
print_success "Virtual environment source added to ~/.bashrc"
fi
else
sudo apt-get install -f -y python3 python3-pyqt5
run_step "Installing python3 and PyQt5 (system-wide)" sudo apt-get install -f -y python3 python3-pyqt5
print_success "Python packages installed system-wide"
fi
# ── Launch the graphical installer ───────────────────────────────────────────
print_header "Step 3/3 — Launching Paparazzi installer GUI"
echo -e " ${YELLOW}${NC} Starting graphical installer..."
echo -e " ${CYAN} Follow the numbered steps in the GUI to complete the installation.${NC}"
echo ""
python3 ./sw/tools/install.py

View File

@@ -13,4 +13,5 @@ distro
empy<=3.3.4
pexpect
setuptools
dronecan

View File

@@ -122,6 +122,7 @@ else
endif
clean:
make -C unifiedmocaprouter clean
clean_opencv_bebop:

View File

@@ -12,12 +12,20 @@ import webbrowser
distro_version = float(distro.version())
docs = 'https://paparazzi-uav.readthedocs.io'
# Terminal colors
RED = '\033[0;31m'
GREEN = '\033[0;32m'
YELLOW = '\033[1;33m'
CYAN = '\033[0;36m'
BOLD = '\033[1m'
NC = '\033[0m'
class InstallWindow(QWidget):
def execute(self,cmd):
self.buttonlist.setEnabled(False)
print(cmd)
print(f' {YELLOW}{NC} {cmd}')
p = subprocess.Popen(cmd, shell=True)
busy = True
while busy:
@@ -29,22 +37,44 @@ class InstallWindow(QWidget):
except subprocess.TimeoutExpired:
busy = True
#print('Tick')
print('================================================================================')
print(cmd)
print('READY (verify above)')
print('Check documentation to resolve problems:', docs)
print('================================================================================')
if p.returncode == 0:
print(f' {GREEN}{NC} {cmd} {GREEN}done{NC}')
print('')
self.buttonlist.setEnabled(True)
return True
else:
print(f' {RED}{BOLD}✘ FAILED:{NC} {cmd}')
print(f'{RED} Check documentation: {docs}{NC}')
print('')
self._ok = False
self.buttonlist.setEnabled(True)
return False
def view(self,link):
webbrowser.open(link)
def step(self, title):
self._ok = True
print(f'\n{CYAN}{BOLD}{"" * 80}')
print(f' {title}')
print(f'{"" * 80}{NC}\n')
def done(self, success_msg, error_msg):
if self._ok:
print(f'\n{GREEN}{BOLD}{success_msg}{NC}\n')
else:
print(f'\n{RED}{BOLD}{error_msg}{NC}')
print(f'{RED} Check documentation: {docs}{NC}\n')
def cmd_repo(self):
self.step('Step 1 — Adding Paparazzi PPA repository')
self.execute('sudo -E add-apt-repository -y ppa:paparazzi-uav/ppa && sudo -E apt-get update')
self.done('Repository added successfully', 'Failed to add the repository')
def cmd_dev(self):
self.step('Step 2 — Installing Paparazzi development packages')
self.execute('sudo -E apt-get -f -y install paparazzi-dev')
self.execute('sudo -E apt-get -f -y install python-is-python3')
# Missing
@@ -59,9 +89,11 @@ class InstallWindow(QWidget):
self.execute('sudo -E apt-get install -y libboost-program-options-dev libboost-filesystem-dev')
if distro_version >= 24.04:
self.execute('python3 -m pip install telnetlib3') # Required for bebop tools
self.done('Paparazzi Dev installed successfully', 'Some development packages failed to install')
def cmd_arm(self):
self.step('Step 3 — Installing ARM compiler for autopilots')
self.execute('sudo -E apt-get -f -y install paparazzi-dev')
if distro_version >= 20.04:
self.execute('sudo -E apt-get install -y python-is-python3 gcc-arm-none-eabi gdb-multiarch')
@@ -70,29 +102,43 @@ class InstallWindow(QWidget):
self.execute('sudo -E add-apt-repository -y ppa:team-gcc-arm-embedded/ppa')
self.execute('sudo -E apt-get update')
self.execute('sudo -E apt-get -f -y install gcc-arm-embedded')
self.done('ARM compiler installed successfully', 'ARM compiler installation failed')
def cmd_jsb(self):
self.step('Step 4 — Installing JSBSim flight simulator')
self.execute('sudo -E apt-get -f -y install paparazzi-jsbsim')
self.done('JSBSim installed successfully', 'JSBSim installation failed')
def cmd_gcs(self):
self.step('Step 5 — Installing binary ground station')
self.execute('sudo -E apt-get -f -y install pprzgcs')
self.execute('sudo -E apt-get -f -y install python3-pyqt5.qtwebkit') # for the documentation
self.done('Ground station installed successfully', 'Ground station installation failed')
def cmd_mcu(self):
self.step('Step 6 — Setting up MCU flash & debug tools')
self.execute('sudo -E apt-get -f -y install dfu-util')
self.execute('sudo -E cp conf/system/udev/rules/*.rules /etc/udev/rules.d/ && sudo -E udevadm control --reload-rules')
self.done('MCU tools installed successfully', 'MCU tools installation failed')
def cmd_gazebo_classic(self):
self.step('Step 7a — Installing Gazebo 11 Classic')
if distro_version <= 22.04:
self.execute('sudo -E apt-get update')
self.execute('sudo -E apt-get -f -y install lsb-release wget gnupg')
self.execute('sudo sh -c \'echo "deb http://packages.osrfoundation.org/gazebo/ubuntu-stable `lsb_release -cs` main" > /etc/apt/sources.list.d/gazebo-stable.list\'')
self.execute('wget http://packages.osrfoundation.org/gazebo.key -O - | sudo apt-key add -')
self.execute('sudo apt update')
self.execute('sudo -E apt-get -f -y install gazebo11 libgazebo11-dev')
# Try gazebo11 first, fallback to gazebo if it fails
if not self.execute('sudo -E apt-get -f -y install gazebo11 libgazebo11-dev'):
print(f'{YELLOW} gazebo11 not available, trying fallback gazebo package...{NC}')
self._ok = True # Reset and try fallback
self.execute('sudo -E apt-get -f -y install gazebo libgazebo-dev')
self.execute('git submodule init && git submodule sync && git submodule update ./sw/ext/tudelft_gazebo_models')
self.done('Gazebo Classic installed successfully', 'Gazebo Classic installation failed')
def cmd_gazebo(self):
self.step('Step 7b — Installing Gazebo Harmonic')
if distro_version >= 22.04:
self.execute('sudo -E apt-get update')
self.execute('sudo -E apt-get -f -y install curl lsb-release gnupg')
@@ -101,22 +147,27 @@ class InstallWindow(QWidget):
self.execute('sudo apt update')
self.execute('sudo -E apt-get -f -y install gz-harmonic')
self.execute('git submodule init && git submodule sync && git submodule update ./sw/ext/tudelft_gazebo_models')
self.done('Gazebo Harmonic installed successfully', 'Gazebo Harmonic installation failed')
def cmd_bebopcv(self):
self.step('Step 8 — Installing Bebop OpenCV')
self.execute('git submodule init && git submodule sync && git submodule update ./sw/ext/opencv_bebop')
if distro_version < 22.04:
self.execute('sudo -E apt-get -f -y install cmake libjpeg-turbo8-dev libpng-dev libtiff-dev zlib1g-dev libdc1394-22-dev')
else:
self.execute('sudo -E apt-get -f -y install cmake libjpeg-turbo8-dev libpng-dev libtiff-dev zlib1g-dev libdc1394-dev')
self.done('Bebop OpenCV installed successfully', 'Bebop OpenCV installation failed')
def cmd_vlc(self):
self.step('Step 9 — Installing VLC, Joystick & NatNet tools')
self.execute('sudo -E apt-get -f -y install ffmpeg vlc jstest-gtk default-jre')
self.execute('sudo -E apt-get install -y python3-pip')
self.execute('python3 -m pip install future') # Required for MAVLink
self.execute('python3 -m pip install pyquaternion ivy-python') # Required for NatNat
self.execute('python3 -m pip install pymap3d') # Required for Moving-Base
self.execute('python3 -m pip install opencv-python') # Required for RTP-viewer
self.done('VLC / Joystick / NatNet installed successfully', 'Some packages failed to install')
def cmd_doc(self):
@@ -124,8 +175,11 @@ class InstallWindow(QWidget):
def cmd_go(self):
self.step('Step 11 — Building and launching Paparazzi Center')
self.execute('make clean')
self.execute('make -j1')
self.done('Build succeeded', 'Build failed — not starting Paparazzi Center')
if self._ok:
self.execute('./paparazzi &')
def cmd_pdf(self):