Bird
Raised Fist0
Drone Programmingprogramming~10 mins

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

Choose your learning style10 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.

Practice

(1/5)
1. What is the main purpose of using ArduPilot SITL in drone programming?
easy
A. To simulate drone flights on a computer without real hardware
B. To control a real drone remotely
C. To build physical drone parts
D. To write drone flight manuals

Solution

  1. Step 1: Understand what SITL means

    SITL stands for Software In The Loop, which means running drone software on a computer instead of a real drone.
  2. Step 2: Identify the purpose of simulation

    Simulation lets you test and control drone behavior safely without risking hardware damage.
  3. Final Answer:

    To simulate drone flights on a computer without real hardware -> Option A
  4. Quick Check:

    Simulation = Safe drone testing on computer [OK]
Hint: SITL means simulating drones on your computer [OK]
Common Mistakes:
  • Thinking SITL controls real drones directly
  • Confusing simulation with hardware building
  • Assuming SITL is for documentation only
2. Which command correctly starts a quadcopter simulation using ArduPilot SITL?
easy
A. sim_vehicle.py -v Boat
B. sim_vehicle.py -v ArduCopter
C. sim_vehicle.py -v Rover
D. sim_vehicle.py -v Plane

Solution

  1. Step 1: Identify the vehicle type for a quadcopter

    ArduCopter is the vehicle type used for quadcopters in ArduPilot SITL.
  2. Step 2: Match the command with the vehicle type

    The command sim_vehicle.py -v ArduCopter starts the quadcopter simulation correctly.
  3. Final Answer:

    sim_vehicle.py -v ArduCopter -> Option B
  4. Quick Check:

    Quadcopter = ArduCopter option [OK]
Hint: Use -v ArduCopter to simulate a quadcopter [OK]
Common Mistakes:
  • Using Plane or Rover for quadcopter simulation
  • Omitting the -v option
  • Typing vehicle names incorrectly
3. What output will you see after running sim_vehicle.py -v ArduPlane successfully?
medium
A. A real drone takes off automatically
B. An error message about unknown vehicle type
C. A simulated plane starts with console showing telemetry and a map window
D. The program exits without any output

Solution

  1. Step 1: Understand what sim_vehicle.py does with ArduPlane

    It launches a plane simulation showing telemetry data in the console and a map window for visualization.
  2. Step 2: Identify expected output

    You should see the simulation start with console messages and a map, not errors or real drone actions.
  3. Final Answer:

    A simulated plane starts with console showing telemetry and a map window -> Option C
  4. Quick Check:

    ArduPlane simulation = console + map output [OK]
Hint: Successful sim_vehicle.py shows console and map [OK]
Common Mistakes:
  • Expecting real drone flight
  • Confusing vehicle types causing errors
  • Thinking no output means success
4. You run sim_vehicle.py -v ArduCopter but get an error: command not found. What is the likely cause?
medium
A. The sim_vehicle.py script is not installed or not in your PATH
B. You typed the vehicle type incorrectly
C. Your computer does not support simulation
D. You need to connect a real drone first

Solution

  1. Step 1: Analyze the error message

    The error 'command not found' means the system cannot find the sim_vehicle.py script to run.
  2. Step 2: Identify common causes

    This usually happens if the script is not installed or its folder is not added to the system PATH environment variable.
  3. Final Answer:

    The sim_vehicle.py script is not installed or not in your PATH -> Option A
  4. Quick Check:

    Command not found = missing script or PATH [OK]
Hint: Check if sim_vehicle.py is installed and in PATH [OK]
Common Mistakes:
  • Assuming vehicle type typo causes command not found
  • Thinking hardware is required to run simulation
  • Ignoring environment PATH settings
5. You want to simulate a drone mission using ArduPilot SITL and automatically log telemetry data. Which command option should you add to sim_vehicle.py to enable logging?
hard
A. -g
B. --log
C. --enable-logs
D. -l

Solution

  1. Step 1: Recall sim_vehicle.py logging options

    The standard option to enable logging in sim_vehicle.py is -l, which starts telemetry logging automatically.
  2. Step 2: Compare options

    Options like --log or --enable-logs are not recognized by sim_vehicle.py, and -g is unrelated.
  3. Final Answer:

    -l -> Option D
  4. Quick Check:

    Logging option = -l [OK]
Hint: Use -l to enable logging in sim_vehicle.py [OK]
Common Mistakes:
  • Using long options not supported by sim_vehicle.py
  • Confusing logging with other flags
  • Forgetting to add any logging option
Recommended

Ready to prove it?

Pass the test and this pattern moves unknown strong while earning +1 Grip toward your certificate.

10 questions~5 mineasy hard