0
0
Drone Programmingprogramming~10 mins

ArduPilot SITL setup in Drone Programming - Step-by-Step Execution

Choose your learning style9 modes available
Concept Flow - ArduPilot SITL setup
Install Dependencies
Download ArduPilot SITL
Build SITL Software
Configure SITL Parameters
Start SITL Simulation
Connect Ground Control Station
Run and Test Drone Simulation
END
This flow shows the main steps to set up ArduPilot SITL: install tools, get code, build, configure, run simulation, connect GCS, and test.
Execution Sample
Drone Programming
git clone https://github.com/ArduPilot/ardupilot.git
cd ardupilot
git submodule update --init --recursive
./waf configure --board sitl
./waf build
sim_vehicle.py -v ArduCopter -f gazebo-iris --console --map
This code clones ArduPilot, configures SITL build, builds it, and starts a copter simulation with console and map.
Execution Table
StepActionCommand/ProcessResult/Output
1Clone ArduPilot repogit clone https://github.com/ArduPilot/ardupilot.gitArduPilot source code downloaded
2Change directory and init submodulescd ardupilot git submodule update --init --recursiveInside ardupilot folder with submodules initialized
3Configure SITL build./waf configure --board sitlBuild system configured for SITL
4Build SITL software./waf buildSITL binaries compiled
5Start SITL simulationsim_vehicle.py -v ArduCopter -f gazebo-iris --console --mapSimulation starts with console and map windows
6Connect GCSOpen Mission Planner or QGroundControlGCS connects to SITL drone
7Run and testUse console and map to control droneDrone simulation runs, responds to commands
8ExitCtrl+C or close windowsSimulation stops
💡 Simulation ends when user stops it manually or closes windows
Variable Tracker
VariableStartAfter Step 1After Step 3After Step 4After Step 5Final
SITL CodeNoneDownloadedConfiguredBuiltRunningStopped
Simulation StateNoneNoneNoneNoneActiveStopped
GCS ConnectionDisconnectedDisconnectedDisconnectedDisconnectedConnectedDisconnected
Key Moments - 3 Insights
Why do we run './waf configure --board sitl' before building?
This step sets up the build system specifically for the SITL environment, so the build knows what to compile. See execution_table row 3.
What happens if you start sim_vehicle.py without building first?
sim_vehicle.py will automatically build the SITL binaries if they don't exist, so it may succeed. However, explicitly building first lets you check for build errors separately. See execution_table rows 4 and 5.
How does the Ground Control Station connect to SITL?
The GCS connects via network ports opened by the running SITL simulation. This happens after simulation starts. See execution_table row 6.
Visual Quiz - 3 Questions
Test your understanding
Look at the execution_table, what is the result after running './waf build'?
ASITL binaries compiled
BSimulation starts
CArduPilot source code downloaded
DBuild system configured
💡 Hint
Check execution_table row 4 under Result/Output
At which step does the simulation become active?
AStep 2
BStep 3
CStep 5
DStep 7
💡 Hint
Look at execution_table row 5 and variable_tracker Simulation State
If you skip cloning the repo, what will happen at step 3?
ASimulation will start without errors
BConfigure will fail because source code is missing
CBuild will succeed anyway
DGCS will connect automatically
💡 Hint
Refer to execution_table row 1 and 3 dependencies
Concept Snapshot
ArduPilot SITL Setup Steps:
1. Clone repo: get source code
2. Configure build for SITL
3. Build SITL binaries
4. Start simulation with sim_vehicle.py
5. Connect Ground Control Station
6. Control and test drone in simulation
Remember: build before running simulation.
Full Transcript
To set up ArduPilot SITL, first install required tools. Then clone the ArduPilot repository using git. Change into the ardupilot directory. Run './waf configure --board sitl' to prepare the build system for SITL. Next, build the SITL binaries with './waf build'. After building, start the simulation using sim_vehicle.py with desired vehicle and options. Open a Ground Control Station like Mission Planner or QGroundControl to connect to the running simulation. Use the console and map windows to control and test the simulated drone. Stop the simulation by closing windows or pressing Ctrl+C. Each step depends on the previous, so follow the order carefully.