Fix Install Scripts

This commit is contained in:
2026-01-07 20:07:38 +00:00
parent e6ed6fcfac
commit a21cd50e9c
3 changed files with 27 additions and 5 deletions

View File

@@ -14,12 +14,18 @@ set -e
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PROJECT_DIR="$(dirname "$SCRIPT_DIR")"
# Deactivate any existing virtual environment to avoid conflicts
if [ -n "$VIRTUAL_ENV" ]; then
deactivate 2>/dev/null || true
fi
# Source ArduPilot environment
if [ -f "$HOME/.ardupilot_env" ]; then
source "$HOME/.ardupilot_env"
fi
# Activate ArduPilot venv (has empy and other dependencies)
# This MUST be the active venv for sim_vehicle.py to work
if [ -f "$HOME/venv-ardupilot/bin/activate" ]; then
source "$HOME/venv-ardupilot/bin/activate"
fi
@@ -36,9 +42,13 @@ if ! command -v sim_vehicle.py &> /dev/null; then
exit 1
fi
# Activate virtual environment if exists
if [ -f "$PROJECT_DIR/venv/bin/activate" ]; then
source "$PROJECT_DIR/venv/bin/activate"
# Verify correct Python environment (ArduPilot venv should have empy)
if ! python3 -c "import em" 2>/dev/null; then
echo "[WARN] empy not found in current Python environment"
echo "[INFO] Attempting to use ArduPilot venv..."
if [ -f "$HOME/venv-ardupilot/bin/activate" ]; then
source "$HOME/venv-ardupilot/bin/activate"
fi
fi
# Start SITL in background