# ArduPilot + Gazebo Simulation ## Quick Start (2 Terminals) **Terminal 1:** ```bash ./scripts/run_ardupilot_sim.sh runway ``` **Terminal 2:** ```bash ./scripts/run_ardupilot_controller.sh ``` ## Architecture ``` ┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐ │ Gazebo │◄───►│ ArduPilot SITL │◄───►│ run_ardupilot.py│ │ (Physics) │JSON │ (Flight Ctrl) │MAV │ (Your Logic) │ └─────────────────┘ └─────────────────┘ └─────────────────┘ ``` ## World Options ```bash ./scripts/run_ardupilot_sim.sh runway # Default ./scripts/run_ardupilot_sim.sh warehouse # Indoor ./scripts/run_ardupilot_sim.sh zephyr # Fixed-wing ``` ## GPS-Denied Mode The simulation runs in GPS-denied mode by default. For manual debugging with MAVProxy: ```bash sim_vehicle.py -v ArduCopter -f gazebo-iris --model JSON --console # In MAVProxy: param set ARMING_CHECK 0 mode stabilize arm throttle force ``` ## Controller Options ```bash ./scripts/run_ardupilot_controller.sh # Auto takeoff ./scripts/run_ardupilot_controller.sh --no-takeoff # Manual ./scripts/run_ardupilot_controller.sh -a 10 # 10m altitude ``` ## Files | File | Purpose | |------|---------| | `scripts/run_ardupilot_sim.sh` | Gazebo + GPU detection | | `scripts/run_ardupilot_controller.sh` | SITL + Controller | | `scripts/run_ardupilot.py` | MAVLink interface | | `src/drone_controller.py` | Your algorithm | ## Troubleshooting ### "No JSON sensor message" Start Gazebo (Terminal 1) before the controller. ### Drone doesn't respond Check mode is GUIDED in MAVProxy. ### Simulation laggy Check GPU: `glxinfo | grep "OpenGL renderer"`