Quick links
https://ardupilot.org/dev/docs/sitl-simulator-software-in-the-loop.html
http://mavlink.io/en/guide/wireshark.html
Intro
Ardupilot is a firmware that is commonly run on COTS flight controllers that WARG uses. These devices use MAVLink as their primary telemetry communication protocol.
MAVLink is a popular messaging protocol used for drones and other RC vehicles, and can provide telemetry data for various vehicles, as well as communicate commands to the aircraft.
In the development of MAVLink-based software, it may be beneficial to have a simulated aircraft upon which you can read and write MAVLink messages to. To achieve this goal, this document focuses on running the Ardupilot SITL (Software In The Loop) Simulator.
Setting up Ardupilot SITL
Mission Planner Setup
The simplest and fastest way to get a running SITL is to use the integrated “Simulation” mode in Mission Planner (https://ardupilot.org/planner/docs/mission-planner-simulation.html#mission-planner-simulation). Using this simulator, we will forward all mavlink messages via TCP to the local computer which can then be connected to via your application.
Download Mission Planner (https://ardupilot.org/planner/docs/mission-planner-installation.html)
Run mission planner, navigate to the “Simulation” tab at the top of the screen
Select the firmware you wish to run at the bottom of the screen. If you are unsure, just select “Multirotor”, then “Stable” in the following popup
Mission planner should automatically download the required SITL files and run them automatically. Mission Planner should then automatically connect with MAVLink to the the simulated aircraft. From this screen you can use Mission Planner as you would normally, switching flight modes, programming automatic missions, etc.
Forward the MAVLink packets that Mission Planner receives by pressing
Crtl + f
on your keyboard, then clicking “Mavlink”In the first dropdown, click “TCP Host - 14550”, then press “Connect”
Enter the TCP Port you would like to use for the MAVLink connection, then press “OK”. The default 14550 should be fine if you are unsure.
If all of these steps have gone successfully, you should have a simulated Ardupilot aircraft running on your computer with its MAVLink messages accessible on your computer’s TCP port that you specified.
Local builds (no Mission Planner)
The Ardupilot website has extensive documentation on setting up the SITL found here (https://ardupilot.org/dev/docs/sitl-simulator-software-in-the-loop.html). You may be able to download the SITL binary without compiling yourself by downloading the firmware from here: https://firmware.ardupilot.org/Copter/latest/. And use https://github.com/ArduPilot/ardupilot/blob/master/Tools/autotest/sim_vehicle.py to run it. (although this is untested).