ArduPilot SITL Update
This commit is contained in:
@@ -3,9 +3,11 @@
|
||||
# Drone Simulation - Ubuntu/Debian Installation Script
|
||||
# =============================================================================
|
||||
# Installs ROS 2, Gazebo, PyBullet, and all required dependencies
|
||||
# Includes optional ArduPilot SITL setup for realistic flight controller
|
||||
# Use --with-ardupilot to also install ArduPilot SITL
|
||||
#
|
||||
# Usage: ./install_ubuntu.sh [--with-ardupilot]
|
||||
# Usage:
|
||||
# ./install_ubuntu.sh # Basic installation
|
||||
# ./install_ubuntu.sh --with-ardupilot # Include ArduPilot SITL
|
||||
# =============================================================================
|
||||
|
||||
set -e
|
||||
@@ -242,62 +244,20 @@ python3 -c "from PIL import Image; print(' Pillow: OK')" || echo " Pillow: FAI
|
||||
python3 -c "from pymavlink import mavutil; print(' pymavlink: OK')" || echo " pymavlink: FAILED"
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# Step 9: Optional ArduPilot SITL Installation
|
||||
# Step 9: ArduPilot SITL Installation (if requested)
|
||||
# -----------------------------------------------------------------------------
|
||||
if [ "$INSTALL_ARDUPILOT" = true ]; then
|
||||
echo ""
|
||||
echo "[STEP 9] Installing ArduPilot SITL..."
|
||||
echo "[INFO] Calling dedicated ArduPilot install script..."
|
||||
|
||||
# Install ArduPilot dependencies
|
||||
sudo apt-get install -y \
|
||||
python3-dev \
|
||||
python3-opencv \
|
||||
python3-wxgtk4.0 \
|
||||
python3-matplotlib \
|
||||
python3-lxml \
|
||||
libxml2-dev \
|
||||
libxslt1-dev || true
|
||||
|
||||
# Clone ArduPilot if not exists
|
||||
if [ ! -d "$HOME/ardupilot" ]; then
|
||||
echo "[INFO] Cloning ArduPilot..."
|
||||
git clone --recurse-submodules https://github.com/ArduPilot/ardupilot.git "$HOME/ardupilot"
|
||||
cd "$HOME/ardupilot"
|
||||
Tools/environment_install/install-prereqs-ubuntu.sh -y
|
||||
cd "$PROJECT_ROOT"
|
||||
# Call the dedicated ArduPilot install script
|
||||
if [ -f "$SCRIPT_DIR/install_ardupilot.sh" ]; then
|
||||
bash "$SCRIPT_DIR/install_ardupilot.sh"
|
||||
else
|
||||
echo "[INFO] ArduPilot already exists at $HOME/ardupilot"
|
||||
echo "[ERROR] install_ardupilot.sh not found!"
|
||||
echo "[INFO] Please run: ./setup/install_ardupilot.sh"
|
||||
fi
|
||||
|
||||
# Clone ArduPilot Gazebo plugin if not exists
|
||||
if [ ! -d "$HOME/ardupilot_gazebo" ]; then
|
||||
echo "[INFO] Cloning ArduPilot Gazebo plugin..."
|
||||
git clone https://github.com/ArduPilot/ardupilot_gazebo.git "$HOME/ardupilot_gazebo"
|
||||
cd "$HOME/ardupilot_gazebo"
|
||||
mkdir -p build && cd build
|
||||
cmake .. -DCMAKE_BUILD_TYPE=Release
|
||||
make -j$(nproc)
|
||||
cd "$PROJECT_ROOT"
|
||||
else
|
||||
echo "[INFO] ArduPilot Gazebo plugin already exists at $HOME/ardupilot_gazebo"
|
||||
fi
|
||||
|
||||
# Add to bashrc
|
||||
if ! grep -q "ARDUPILOT_HOME" ~/.bashrc; then
|
||||
echo '' >> ~/.bashrc
|
||||
echo '# ArduPilot SITL' >> ~/.bashrc
|
||||
echo 'export ARDUPILOT_HOME=$HOME/ardupilot' >> ~/.bashrc
|
||||
echo 'export PATH=$PATH:$ARDUPILOT_HOME/Tools/autotest' >> ~/.bashrc
|
||||
fi
|
||||
|
||||
if ! grep -q "ardupilot_gazebo" ~/.bashrc; then
|
||||
echo '' >> ~/.bashrc
|
||||
echo '# ArduPilot Gazebo Plugin' >> ~/.bashrc
|
||||
echo 'export GZ_SIM_SYSTEM_PLUGIN_PATH=$HOME/ardupilot_gazebo/build:$GZ_SIM_SYSTEM_PLUGIN_PATH' >> ~/.bashrc
|
||||
echo 'export GZ_SIM_RESOURCE_PATH=$HOME/ardupilot_gazebo/models:$HOME/ardupilot_gazebo/worlds:$GZ_SIM_RESOURCE_PATH' >> ~/.bashrc
|
||||
fi
|
||||
|
||||
echo "[INFO] ArduPilot SITL installed"
|
||||
fi
|
||||
|
||||
echo ""
|
||||
|
||||
Reference in New Issue
Block a user