Files
simulation/docs/setup_guide.md

3.3 KiB

Setup Guide

Prerequisites

  • Ubuntu 22.04 (Humble) or 24.04 (Jazzy)
  • 16GB RAM minimum
  • 50GB free disk space
  • Internet connection
  • ffmpeg, x11-utils, xdotool (installed automatically by setup.sh)

Automatic Installation

The setup.sh script installs everything automatically:

cd ~/sim/uav_ugv_simulation
bash setup.sh

What Gets Installed

  1. ROS 2 (Humble or Jazzy based on Ubuntu version)
  2. Gazebo Harmonic (modern simulation)
  3. ArduPilot SITL (flight controller)
  4. ardupilot_gazebo plugin (ArduPilot-Gazebo bridge)
  5. Python dependencies (pymavlink, opencv, scipy, etc.)
  6. MAVROS (ROS 2 - MAVLink bridge)

Installation Time

  • First install: 20-40 minutes
  • ArduPilot build: ~15 minutes
  • Gazebo plugin build: ~5 minutes

Manual Installation

Step 1: Install ROS 2 and System Dependencies

# Ubuntu 22.04
sudo apt install software-properties-common x11-utils xdotool ffmpeg
sudo add-apt-repository universe
sudo apt update && sudo apt install curl -y
sudo curl -sSL https://raw.githubusercontent.com/ros/rosdistro/master/ros.key -o /usr/share/keyrings/ros-archive-keyring.gpg
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/ros-archive-keyring.gpg] http://packages.ros.org/ros2/ubuntu $(. /etc/os-release && echo $UBUNTU_CODENAME) main" | sudo tee /etc/apt/sources.list.d/ros2.list > /dev/null
sudo apt update
sudo apt install ros-humble-desktop

Step 2: Install Gazebo Harmonic

sudo apt install -y wget
sudo wget https://packages.osrfoundation.org/gazebo.gpg -O /usr/share/keyrings/pkgs-osrf-archive-keyring.gpg
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/pkgs-osrf-archive-keyring.gpg] http://packages.osrfoundation.org/gazebo/ubuntu-stable $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/gazebo-stable.list
sudo apt update
sudo apt install gz-harmonic

Step 3: Install ArduPilot

cd ~
git clone --recurse-submodules https://github.com/ArduPilot/ardupilot.git
cd ardupilot
Tools/environment_install/install-prereqs-ubuntu.sh -y
. ~/.profile
./waf configure --board sitl
./waf copter

Step 4: Install ardupilot_gazebo Plugin

cd ~
git clone https://github.com/ArduPilot/ardupilot_gazebo.git
cd ardupilot_gazebo
mkdir build && cd build
cmake .. -DCMAKE_BUILD_TYPE=RelWithDebInfo
make -j4

Step 5: Install Python Dependencies

cd ~/sim/uav_ugv_simulation
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt

Environment Setup

After installation, source the environment:

source ~/sim/uav_ugv_simulation/activate_venv.sh

This sets up:

  • Python virtual environment
  • Gazebo resource paths
  • ArduPilot paths

Verify Installation

# Check Gazebo
gz sim --version

# Check ArduPilot
sim_vehicle.py --help

# Check Python deps
python3 -c "import pymavlink; print('pymavlink OK')"
python3 -c "import cv2; print('opencv OK')"

Uninstall

# Remove ArduPilot and plugin only
bash scripts/uninstall.sh

# Remove everything including venv
bash scripts/uninstall.sh --all

Next Steps

  1. Run a test simulation: bash scripts/run_autonomous.sh --search spiral
  2. Read the Usage Guide
  3. Check Troubleshooting if issues arise