Plane SITL/MAVProxy Tutorial

This tutorial provides a basic walk-through of how to use SITL and MAVProxy for Plane testing.


The article is intended primarily for developers who want to test new Plane builds and bug fixes using SITL and MAVProxy. It shows how to take off, run missions, fly in GUIDED mode, set a geofence, and perform a number of other basic testing tasks.

The tutorial is complementary to the topic Using SITL for ArduPilot Testing.


  • We use MAVProxy here, but you can attach another ground station to SITL if you prefer (similar instructions can be used in any GCS).
  • This tutorial is for Plane - see Copter and Rover for similar tutorials on the other vehicles.


The tutorial assumes you have already set up SITL on Windows or Linux and that you have started SITL using the --map and --console options:

cd ~/ardupilot/ArduPlane -j4 --map --console

As part of the setup you should have loaded some standard/test parameters into the MAVProxy Command Prompt:

param load ..\Tools\autotest\default_params\plane-jsbsim.parm


  • Some arduplane versions’ param path is not same as this, if fail to open file, you should check param path.
  • In ardupilot/ArduPlane file, there is a mav.parm with all parameters. If you want to change more params you can edit it and load it.

The MAVProxy Command Prompt, Console and Map should be arranged conveniently so you can observe the status and send commands at the same time.


Taking off

To take off with Plane you should use a mission (AUTO mode) that contains the MAV_CMD_NAV_TAKEOFF command. Once you are airborne you can switch to other other flight modes.


At time of writing, Plane only supports automated takeoff in AUTO mode as part of a mission. If you want to change to GUIDED mode (or any other mode) then you first have to take off using a mission.

First load the CMAC-circuit.txt test mission using the wp load command as shown below (this mission contains the takeoff command):

wp load ..\Tools\autotest\CMAC-circuit.txt
wp list

Once the mission is loaded you can take off by arming the throttle and setting the mode to AUTO (the order of these operations does not matter):

mode auto
arm throttle

The plane should take off to an altitude of 40 metres and then proceed through the other mission waypoints (most of which have an altitude of 100m). You can stop/pause the mission at any time by changing the mode.


During takeoff you can watch the altitude increase on the console in the Alt field.

Developers may find it useful to graph the takeoff by first entering the gtakeoff command.


MAVProxy: PlaneTakeoff Graph (gtakeoff)


The most common sources of difficulty taking off are:

  1. Using a mission that does not contain a takeoff command!
  2. Attempting to takeoff when the vehicle is not armed. This can happen if the vehicle fails pre-arm checks.

You can list all enabled checks using the command arm list:

LAND> arm list
LAND> all

You can enable and disable checks using arm check n and arm uncheck n respectively, where n is the name of the check. Use n value of of all to enables/disable all checks.

Flying a mission

You can load a mission at any time using the wp load command. The mission will start as soon as the vehicle is armed and you’re in AUTO mode.

The example below shows how to load and start one of the test missions, skip to the second waypoint using wp set n, and loop the mission:

wp load ..\Tools\autotest\CMAC-circuit.txt
mode auto
wp set 2
wp loop

The MAVProxy Waypoints documentation lists the full set of available commands (or you can get them using auto-completion by typing “wp” on the command line).

If you want to create a waypoint mission, this is most easily done on the map:

  1. Right-click on the map and then select Mission | Draw.


    MAVProxy: Draw Mission Menu

  2. Left-click on the map where you want the points to appear.


    Nothing visible will happen when you make the first click. After the second click, lines will join your points to show the path.

  3. When you’re done, you can loop the mission by right-clicking on the map and selecting Mission | Loop.

This approach only allows you to create MAV_CMD_NAV_WAYPOINT commands. You can edit missions and use other commands on Linux using the misseditor module (module load misseditor). This is currently broken on Windows. It is also possible to load other types of commands from files.

Changing flight modes

Plane supports a number of flight modes, which you can list in MAVProxy using the mode command:

AUTO> mode

You can set the mode by entering mode MODENAME on the MAVProxy command prompt.

For example, the command below shows how to put Plane into CIRCLE mode (this is like Loiter, except that the plane does not attempt to hold position).

mode circle

Guiding the vehicle

Once you’ve taken off you can move the vehicle around the map in GUIDED mode. Plane will fly to a specified point, and then circle it.

First change the mode:

mode guided

The easiest way to set a target point is to right-click on the map where you want to go, select Fly to, and then enter the target altitude.


MAVProxy: Fly toLocation

You can also enter the target position manually on the command line using the two formats below. If only the altitude is specified, the last specified LAT/LON will be used.



Unlike with Copter, you can’t do much with Plane in GUIDED mode because the mode does not support many commands. This mode is primarily useful for simply flying to a point.

Setting a GeoFence

A GeoFence is is a virtual barrier that Plane uses to constrain the movement of the vehicle (and move it to a safe location if control is lost). Plane allows you to specify an arbitrarily shaped region on the map for the fence, and an upper and lower altitude. If the fence is breached, Plane will fly to the centre of the fence and circle (or a rally poin)t. Geo-Fencing in Plane describes the fence in more detail.

The fence behaviour is set using the Plane Fence Parameters. You can list these with param show:

GUIDED> param show fence*
FENCE_CHANNEL    0.000000
FENCE_MAXALT     0.000000
FENCE_MINALT     0.000000
FENCE_RETALT     0.000000
FENCE_TOTAL      7.000000

Creating the fence is very similar to creating a waypoint mission:

  1. Right-click on the map and then select Fence | Draw.


    MAVProxy: Draw Fence Menu

  2. Left-click on the map at points where you want the fence “posts” to appear.


    Nothing visible will happen when you make the first click. After the second click, lines will join your points to show the path.

  3. When you’re done, you can loop the fence by right-clicking on the map.


    MAVProxy: Draw Fence Points

  4. The fence is initially disabled. To turn it on set the value to one:

    GUIDED> fence enable
  5. Now lets make the plane cross the barrier. Assuming you are already flying you can use the following to make it fly straight ahead into the fence:

    GUIDED> mode cruise
  6. When the fence is crossed, the plane will fly to the centre of the fence region and then circle. The console shows that the breach has occurred.


    MAVProxy: Fence Breach shown on Console and Map

Instead of flying to the centre of the fence you can instead add a rally point to the map and fly to it by enabling the parameter FENCE_RET_RALLY.

Testing the vehicle

MAVProxy allows you to list all the parameters affecting the vehicle and simulation using param show *, and to set any parameter using: param set PARAM_NAME VALUE. In addition to affecting the vehicle itself some parameters simulate the performance/failure of specific hardware components and the environment (for example, the wind). These can be listed using: :ref:`param show sim*`. The topic Using SITL for ArduPilot Testing <using-sitl-for-ardupilot-testing> explains more about how you can test using SITL.