Simulation

../_images/simulation-landingpage.jpg

Simulation allows for the safe testing of experimental code and settings. Crashing virtual vehicles is a lot cheaper than crashing real ones!

Overview

Simulation is implemented by using a Flight Dynamics Model (FDM) of the vehicle to simulate the physics involved with vehicle movement. It receives inputs from a SITL (Software in the Loop) program running the ArduPilot firmware (which are the firmware’s servo/motor outputs) and outputs vehicle status,position, velocities, etc. that result from those inputs back to the firmware simulation. Just as sensors would in the real world case.

Pilot control is implemented either by joystick, dedicated simulation controller box(like Interlink), or by MAVLink commands from a Ground Control Station program (GCS), like MAVProxy or Mission Planner.

This is illustrated below:

../_images/SITL.png

ArduPilot provides a native firmware simulator + FDM program (all launched by sim_vehicle.py), often simply referred to as SITL, which is usually used with its developer GCS, MAVProxy. ArduPilot’s firmware simulator and FDM can also be used by Mission Planner for SITL simulations.

In addition, the ArduPilot firmware simulator element can also be interfaced to other FDM/Graphics programs that are normally used as stand-alone flight/vehicle simulators in order to get more realistic physics models and/or high definition vehicle graphics, such as RealFlight or X-Plane.

Tip

We recommend starting with ArduPilot’s native Software In The Loop (SITL) because the setup is easiest, it does not require a flight controller, and all vehicle types are supported.

The most commonly used simulators are:

  • SITL (Software In The Loop) is the simulator most commonly used by developers. It is a simple simulator that is built within all SITL builds of ArduPilot. It is used by the autotester and other simulators below are actually built on top of SITL
  • Gazebo is the official DARPA virtual robotics simulator
  • XPlane-10 a commercial flight simulator with a rich 3D interface
  • XPlane-10 Soaring soaring on XPlane-10
  • RealFlight a commercial flight simulator with a rich 3D interface and ability to design custom vehicles
  • Morse a robotics simulation environment commonly used in research
  • Replay has no graphical interface but allows re-running master from a dataflash log
  • JSBSim is a sophisticated open-source plane and multicopter simulator with no graphical interface. It can be used with a wide variety of airframes.
  • AirSim is an open-source, cross-platform simulator for drones & cars, built on Unreal Engine for physically and visually realistic simulations
  • Silent Wings Soaring
  • MATLAB and Simulink are numerical computing environments used for developing algorithms and plotting data developed by MathWorks.
  • JSON interface The JSON interface is a generic interface protocol designed to be easy to implement for those developing physics backend. There are Python and MATLAB examples.
  • Webots is a simulator mainly used for robotics. It is easy to build many vehicles using it. ArduPilot has Rover, Quadcopter, and Tricopters examples that have been built especially for this simulator.

Less often used simulators include:

  • Last Letter is a simpler simulator (fixed wing only) with lower CPU requirements than most other simulators.
  • CRRCSim is a less commonly used simulator for fixed wing and helictopers.
  • SCRIMMAGE is an open-source vehicle simulator focused on collaborative robotics

List of simulators (so they can appear in the menu):