# Installation Guide ## System Requirements | Requirement | Minimum | Recommended | |-------------|---------|-------------| | **OS** | Ubuntu 22.04 | Ubuntu 24.04 | | **RAM** | 8 GB | 16 GB | | **Disk** | 10 GB | 20 GB | | **GPU** | OpenGL 3.3 | NVIDIA/AMD dedicated | > **Windows users**: Use WSL2 with Ubuntu (see below) ## Quick Install (Ubuntu/WSL2) ```bash # Clone repository git clone ~/RDC_Simulation cd ~/RDC_Simulation # Run full installer (includes ArduPilot) ./setup/install_ubuntu.sh --with-ardupilot # Reload shell source ~/.bashrc ``` This installs: - ✅ Python 3 + virtual environment - ✅ Gazebo Harmonic - ✅ ArduPilot SITL - ✅ ArduPilot Gazebo plugin - ✅ MAVProxy ## Windows (WSL2) ### Step 1: Install WSL2 Open PowerShell as Administrator: ```powershell wsl --install -d Ubuntu-24.04 ``` Restart your computer, then open "Ubuntu" from the Start menu. ### Step 2: Install in WSL ```bash # Update system sudo apt update && sudo apt upgrade -y # Clone and install git clone ~/RDC_Simulation cd ~/RDC_Simulation ./setup/install_ubuntu.sh --with-ardupilot # Reload shell source ~/.bashrc ``` ### WSL2 Tips - **GUI**: Windows 11 has WSLg built-in. Gazebo should work automatically. - **GPU**: Install [NVIDIA WSL driver](https://developer.nvidia.com/cuda/wsl) for GPU acceleration - **Performance**: Keep files in Linux filesystem (`~/`), not Windows (`/mnt/c/`) - **Memory**: WSL may need more RAM. Create `~/.wslconfig` in Windows: ```ini [wsl2] memory=8GB ``` ## Arch Linux ```bash ./setup/install_arch.sh --with-ardupilot source ~/.bashrc ``` ## macOS macOS doesn't support Gazebo Harmonic. Options: 1. **Docker**: Run Linux in container 2. **VM**: Use UTM/Parallels with Ubuntu 3. **Basic**: PyBullet-only simulation ```bash ./setup/install_macos.sh ``` ## Verify Installation ```bash # Check ArduPilot environment source ~/.ardupilot_env python -c "import em; print('empy: OK')" which sim_vehicle.py # Check Gazebo gz sim --version # Check ArduPilot plugin ls ~/ardupilot_gazebo/build/libArduPilotPlugin.so ``` ## First Run ### Terminal 1 - Gazebo ```bash cd ~/RDC_Simulation ./scripts/run_ardupilot_sim.sh runway ``` Wait for the drone to appear! ### Terminal 2 - SITL ```bash source ~/.ardupilot_env sim_vehicle.py -v ArduCopter -f gazebo-iris --model JSON --console ``` Wait for "JSON received:" messages. ### Terminal 3 - Controller ```bash cd ~/RDC_Simulation source activate.sh python scripts/run_ardupilot.py --pattern square ``` ## Troubleshooting ### "empy not found" ```bash source ~/.ardupilot_env pip install empy==3.3.4 ``` ### "sim_vehicle.py not found" ```bash source ~/.ardupilot_env # Or add to PATH manually: export PATH=$PATH:~/ardupilot/Tools/autotest ``` ### "No JSON sensor message" SITL isn't receiving data from Gazebo. - Start Gazebo FIRST - Wait for world to fully load - Then start SITL ### Gazebo crashes or slow ```bash # Check GPU glxinfo | grep "OpenGL renderer" # Force software rendering (slow but works) export LIBGL_ALWAYS_SOFTWARE=1 ``` ### WSL: Display not working ```bash # Check WSLg ls /mnt/wslg # Update WSL if missing wsl --update ``` ### ArduPlane instead of ArduCopter If mode list shows FBWA, FBWB (plane modes): ```bash pkill -9 -f sim_vehicle sim_vehicle.py -v ArduCopter -f gazebo-iris --model JSON --console --wipe-eeprom ```