Ardupilot Update
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
# =============================================================================
|
||||
# Installs PyBullet and Python dependencies
|
||||
# ROS 2 requires AUR (optional - not needed for standalone mode)
|
||||
# ArduPilot SITL can be built from source (optional)
|
||||
#
|
||||
# Usage: ./install_arch.sh
|
||||
# =============================================================================
|
||||
@@ -153,6 +154,7 @@ echo "Checking Python packages:"
|
||||
python -c "import pybullet; print(' PyBullet: OK')" || echo " PyBullet: FAILED"
|
||||
python -c "import numpy; print(' NumPy: OK')" || echo " NumPy: FAILED"
|
||||
python -c "from PIL import Image; print(' Pillow: OK')" || echo " Pillow: FAILED"
|
||||
python -c "from pymavlink import mavutil; print(' pymavlink: OK')" || echo " pymavlink: FAILED"
|
||||
|
||||
echo ""
|
||||
echo "=============================================="
|
||||
@@ -185,4 +187,28 @@ echo "After installing, use:"
|
||||
echo " ign gazebo gazebo/worlds/drone_landing.sdf # Terminal 1"
|
||||
echo " python run_gazebo.py --pattern circular # Terminal 2"
|
||||
echo ""
|
||||
echo "=============================================="
|
||||
echo " Optional: Install ArduPilot SITL"
|
||||
echo "=============================================="
|
||||
echo ""
|
||||
echo "For realistic flight controller simulation:"
|
||||
echo ""
|
||||
echo " # Clone and build ArduPilot"
|
||||
echo " git clone --recurse-submodules https://github.com/ArduPilot/ardupilot.git ~/ardupilot"
|
||||
echo " cd ~/ardupilot"
|
||||
echo " pip install -r Tools/environment_install/requirements.txt"
|
||||
echo ""
|
||||
echo " # Clone and build ArduPilot Gazebo plugin"
|
||||
echo " git clone https://github.com/ArduPilot/ardupilot_gazebo.git ~/ardupilot_gazebo"
|
||||
echo " cd ~/ardupilot_gazebo && mkdir build && cd build"
|
||||
echo " cmake .. && make -j$(nproc)"
|
||||
echo ""
|
||||
echo " # Add to environment"
|
||||
echo " export ARDUPILOT_HOME=~/ardupilot"
|
||||
echo " export PATH=\$PATH:\$ARDUPILOT_HOME/Tools/autotest"
|
||||
echo " export GZ_SIM_SYSTEM_PLUGIN_PATH=~/ardupilot_gazebo/build:\$GZ_SIM_SYSTEM_PLUGIN_PATH"
|
||||
echo ""
|
||||
echo "Then run:"
|
||||
echo " python run_ardupilot.py --pattern circular"
|
||||
echo ""
|
||||
|
||||
|
||||
@@ -3,8 +3,9 @@
|
||||
# Drone Simulation - Ubuntu/Debian Installation Script
|
||||
# =============================================================================
|
||||
# Installs ROS 2, Gazebo, PyBullet, and all required dependencies
|
||||
# Includes optional ArduPilot SITL setup for realistic flight controller
|
||||
#
|
||||
# Usage: ./install_ubuntu.sh
|
||||
# Usage: ./install_ubuntu.sh [--with-ardupilot]
|
||||
# =============================================================================
|
||||
|
||||
set -e
|
||||
@@ -47,10 +48,20 @@ sudo apt-get install -y \
|
||||
python3 \
|
||||
python3-pip \
|
||||
python3-venv \
|
||||
git
|
||||
git \
|
||||
cmake \
|
||||
build-essential
|
||||
|
||||
echo "[INFO] System dependencies installed"
|
||||
|
||||
# Check for ArduPilot option
|
||||
INSTALL_ARDUPILOT=false
|
||||
for arg in "$@"; do
|
||||
if [ "$arg" = "--with-ardupilot" ]; then
|
||||
INSTALL_ARDUPILOT=true
|
||||
fi
|
||||
done
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# Step 2: ROS 2 Repository Setup
|
||||
# -----------------------------------------------------------------------------
|
||||
@@ -190,10 +201,25 @@ fi
|
||||
# Set Gazebo model path
|
||||
export GZ_SIM_RESOURCE_PATH="$SCRIPT_DIR/gazebo/models:$GZ_SIM_RESOURCE_PATH"
|
||||
|
||||
# Set ArduPilot paths if installed
|
||||
if [ -d "$HOME/ardupilot" ]; then
|
||||
export ARDUPILOT_HOME="$HOME/ardupilot"
|
||||
export PATH="$PATH:$ARDUPILOT_HOME/Tools/autotest"
|
||||
echo "[OK] ArduPilot SITL available"
|
||||
fi
|
||||
|
||||
# Set ArduPilot Gazebo plugin path if installed
|
||||
if [ -d "$HOME/ardupilot_gazebo/build" ]; then
|
||||
export GZ_SIM_SYSTEM_PLUGIN_PATH="$HOME/ardupilot_gazebo/build:$GZ_SIM_SYSTEM_PLUGIN_PATH"
|
||||
export GZ_SIM_RESOURCE_PATH="$HOME/ardupilot_gazebo/models:$HOME/ardupilot_gazebo/worlds:$GZ_SIM_RESOURCE_PATH"
|
||||
echo "[OK] ArduPilot Gazebo plugin available"
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo "Environment ready! Run one of:"
|
||||
echo " python standalone_simulation.py (No ROS 2 required)"
|
||||
echo " python simulation_host.py (With ROS 2)"
|
||||
echo " python run_ardupilot.py (With ArduPilot SITL)"
|
||||
echo ""
|
||||
EOF
|
||||
|
||||
@@ -213,6 +239,66 @@ echo "Checking Python packages:"
|
||||
python3 -c "import pybullet; print(' PyBullet: OK')" || echo " PyBullet: FAILED"
|
||||
python3 -c "import numpy; print(' NumPy: OK')" || echo " NumPy: FAILED"
|
||||
python3 -c "from PIL import Image; print(' Pillow: OK')" || echo " Pillow: FAILED"
|
||||
python3 -c "from pymavlink import mavutil; print(' pymavlink: OK')" || echo " pymavlink: FAILED"
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# Step 9: Optional ArduPilot SITL Installation
|
||||
# -----------------------------------------------------------------------------
|
||||
if [ "$INSTALL_ARDUPILOT" = true ]; then
|
||||
echo ""
|
||||
echo "[STEP 9] Installing ArduPilot SITL..."
|
||||
|
||||
# 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"
|
||||
else
|
||||
echo "[INFO] ArduPilot already exists at $HOME/ardupilot"
|
||||
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 ""
|
||||
echo "=============================================="
|
||||
@@ -223,8 +309,17 @@ echo "Quick start:"
|
||||
echo " source activate.sh"
|
||||
echo " python standalone_simulation.py"
|
||||
echo ""
|
||||
echo "Or with ROS 2:"
|
||||
echo "With ROS 2 + Gazebo:"
|
||||
echo " python simulation_host.py # Terminal 1"
|
||||
echo " python ros_bridge.py # Terminal 2"
|
||||
echo " python controllers.py # Terminal 3"
|
||||
echo " python run_bridge.py # Terminal 2"
|
||||
echo ""
|
||||
echo "With ArduPilot SITL (realistic flight controller):"
|
||||
echo " ros2 launch gazebo/launch/ardupilot_drone.launch.py # Terminal 1"
|
||||
echo " sim_vehicle.py -v ArduCopter -f gazebo-iris --model JSON # Terminal 2"
|
||||
echo " python run_ardupilot.py --no-sitl # Terminal 3"
|
||||
echo ""
|
||||
if [ "$INSTALL_ARDUPILOT" != true ]; then
|
||||
echo "To install ArduPilot SITL, run:"
|
||||
echo " ./setup/install_ubuntu.sh --with-ardupilot"
|
||||
echo ""
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user