Skip to content

Plan File Format ​

Plan files are stored in JSON file format and contain mission, geofence, and rally point objects. The geofence and rally point objects are required, but their lists can be empty. Below you can see the top level format of a Plan file

TIP

This is "near-minimal" - a plan must contain at least one mission item. The plan fence and rally points are also used in modes when no mission is running.

json
{
  "fileType": "Plan",
  "geoFence": {
    "circles": [],
    "polygons": [],
    "version": 2
  },
  "groundStation": "QGroundControl",
  "mission": {},
  "rallyPoints": {
    "points": [],
    "version": 2
  },
  "version": 1
}

The main fields are:

KeyDescription
versionThe version for this file. Current version is 1.
fileTypeMust be "Plan".
groundStationThe name of the ground station which created this file (here QGroundControl)
missionThe mission associated with this flight plan.
geoFenceRequired geofence object. Its circles and polygons lists may be empty.
rallyPointsRequired rally point object. Its points list may be empty.

Mission Object ​

The structure of the mission object is shown below. The items field contains a comma-separated list of mission items (it must contain at least one mission item, as shown below). The list may be a mix of both SimpleItem and ComplexItem objects.

json
    "mission": {
        "cruiseSpeed": 15,
        "firmwareType": 12,
        "globalPlanAltitudeMode": 1,
        "hoverSpeed": 5,
        "items": [
            {
                "AMSLAltAboveTerrain": null,
                "Altitude": 50,
                "AltitudeMode": 0,
                "autoContinue": true,
                "command": 22,
                "doJumpId": 1,
                "frame": 3,
                "params": [
                    15,
                    0,
                    0,
                    null,
                    47.3985099,
                    8.5451002,
                    50
                ],
                "type": "SimpleItem"
            }
        ],
        "plannedHomePosition": [
            47.3977419,
            8.545594,
            487.989
        ],
        "vehicleType": 2,
        "version": 2
    },

The following values are required:

KeyDescription
versionThe version for the mission object. Current version is 2.
firmwareTypeThe firmware type for which this mission was created. This is one of the MAV_AUTOPILOT enum values.
globalPlanAltitudeModeThe global plan-wide altitude mode setting. This is used by plan items that don't specify an "AltitudeMode".
vehicleTypeThe vehicle type for which this mission was created. This is one of the MAV_TYPE enum values.
cruiseSpeedThe default forward speed for Fixed wing or VTOL vehicles (i.e. when moving between waypoints).
hoverSpeedThe default forward speed for multi-rotor vehicles.
itemsThe list of mission item objects associated with the mission . The list may contain either/both SimpleItem and ComplexItem objects.
plannedHomePositionThe planned home position is shown on the map and used for mission planning when no vehicle is connected. The array values shown above are (from top): latitude, longitude and AMSL altitude.

The format of the simple and complex items is given below.

SimpleItem - Simple Mission Item ​

A simple item represents a single MAVLink MISSION_ITEM command.

json
            {
                "AMSLAltAboveTerrain": null,
                "Altitude": 50,
                "AltitudeMode": 0,
                "autoContinue": true,
                "command": 22,
                "doJumpId": 1,
                "frame": 3,
                "params": [
                    15,
                    0,
                    0,
                    null,
                    47.3985099,
                    8.5451002,
                    50
                ],
                "type": "SimpleItem"
            }

The field mapping is shown below.

KeyDescription
typeSimpleItem for a simple item
AMSLAltAboveTerrainAltitude value shown to the user.
Altitude
AltitudeMode
autoContinueMISSION_ITEM.autoContinue
commandThe command (MAV_CMD) for this mission item - see MISSION_ITEM.command.
doJumpIdThe target id for the current mission item in DO_JUMP commands. These are auto-numbered from 1.
frameMAV_FRAME (see MISSION_ITEM.frame)
paramsMISSION_ITEM.param1,2,3,4,x,y,z (values depends on the particular MAV_CMD).

Complex Mission Item ​

A complex item is a higher level encapsulation of multiple MISSION_ITEM objects treated as a single entity.

There are currently three types of complex mission items:

Survey - Complex Mission Item ​

The object definition for a Survey complex mission item is given below.

json
{
                "TransectStyleComplexItem": {
                    ...
                },
                "angle": 0,
                "complexItemType": "survey",
                "entryLocation": 0,
                "flyAlternateTransects": false,
                "polygon": [
                    [
                        -37.75170619863631,
                        144.98414811224316
                    ],
                    ...
                    [
                        -37.75170619863631,
                        144.99457681259048
                    ]
                ],
                "splitConcavePolygons": false,
                "type": "ComplexItem",
                "version": 5
            },

Complex items have these values associated with them:

KeyDescription
versionThe version number for this survey definition. Current version is 5.
typeComplexItem (this is a complex item).
complexItemTypesurvey
TransectStyleComplexItemThe common base definition for Survey and CorridorScan complex items.
angleThe angle for the transect paths (degrees).
entryLocation?
flyAlternateTransectsIf true, the vehicle will skip every other transect and then come back at the end and fly these alternates. This can be used for fixed wing aircraft when the turnaround would be too acute for the vehicle to make the turn.
polygonThe polygon array which represents the polygonal survey area. Each point is a latitude, longitude pair for a polygon vertex.
splitConcavePolygonsIf true, transects are split where they cross a concave part of the polygon so that each transect stays inside the survey area (version 5).

Corridor Scan ​

The object definition for a CorridorScan complex mission item is given below.

json
            {
                "CorridorWidth": 50,
                "EntryPoint": 0,
                "TransectStyleComplexItem": {
                    ...
                    },
                },
                "complexItemType": "CorridorScan",
                "polyline": [
                    [
                        -37.75234887156983,
                        144.9893624624168
                    ],
                    ...
                    [
                        -37.75491914850321,
                        144.9893624624168
                    ]
                ],
                "type": "ComplexItem",
                "version": 2
            },
KeyDescription
versionThe version for this CorridorScan definition. Current version is 2.
typeComplexItem (this is a complex item).
complexItemTypeCorridorScan
CorridorWidth?
EntryPoint?
TransectStyleComplexItemThe common base definition for Survey and CorridorScan complex items.
polyline?

Structure Scan ​

The object definition for a StructureScan complex mission item is given below.

json
            {
                "Altitude": 50,
                "CameraCalc": {
                    "AdjustedFootprintFrontal": 25,
                    "AdjustedFootprintSide": 25,
                    "CameraName": "Manual (no camera specs)",
                    "DistanceToSurface": 10,
                    "DistanceToSurfaceRelative": true,
                    "version": 1
                },
                "Layers": 1,
                "StructureHeight": 25,
                "altitudeRelative": true,
                "complexItemType": "StructureScan",
                "polygon": [
                    [
                        -37.753184359536355,
                        144.98879374063998
                    ],
                    ...
                    [
                        -37.75408368012594,
                        144.98879374063998
                    ]
                ],
                "type": "ComplexItem",
                "version": 2
            }
KeyDescription
versionThe version for this StructureScan definition. Current version is 2.
typeComplexItem (this is a complex item).
complexItemTypeStructureScan
Altitude?
CameraCalc?
Layers?
StructureHeight?
altitudeRelativetrue: altitude is relative to home, false: altitude is AMSL.
polygon?

TransectStyleComplexItem ​

TransectStyleComplexItem contains the common base definition for survey and CorridorScan complex items.

json
                "TransectStyleComplexItem": {
                    "CameraCalc": {
                        ...
                    },
                    "CameraTriggerInTurnAround": true,
                    "FollowTerrain": false,
                    "HoverAndCapture": false,
                    "Items": [
                        ...
                    ],
                    "Refly90Degrees": false,
                    "TurnAroundDistance": 10,
                    "VisualTransectPoints": [
                        [
                            -37.75161626657736,
                            144.98414811224316
                        ],
                        ...
                        [
                            -37.75565155437309,
                            144.99438539496475
                        ]
                    ],
                    "version": 1
                },
KeyDescription
versionThe version for this TransectStyleComplexItem definition. Current version is 1.
CameraCalc?
CameraTriggerInTurnAround? (boolean)
FollowTerrain? (boolean)
HoverAndCapture? (boolean)
Items?
Refly90Degrees? (boolean)
TurnAroundDistanceThe distance to fly past the polygon edge prior to turning for the next transect.
VisualTransectPoints?

CameraCalc ​

The CameraCalc contains camera information used for a survey, corridor or structure scan.

json
                    "CameraCalc": {
                        "AdjustedFootprintFrontal": 272.4,
                        "AdjustedFootprintSide": 409.2,
                        "CameraName": "Sony ILCE-QX1",
                        "DistanceToSurface": 940.6896551724138,
                        "DistanceToSurfaceRelative": true,
                        "FixedOrientation": false,
                        "FocalLength": 16,
                        "FrontalOverlap": 70,
                        "ImageDensity": 25,
                        "ImageHeight": 3632,
                        "ImageWidth": 5456,
                        "Landscape": true,
                        "MinTriggerInterval": 0,
                        "SensorHeight": 15.4,
                        "SensorWidth": 23.2,
                        "SideOverlap": 70,
                        "ValueSetIsDistance": false,
                        "version": 1
                    },
KeyDescription
versionThe version for this CameraCalc definition. Current version is 1.
AdjustedFootprintFrontal?
AdjustedFootprintSide?
DistanceToSurface? Units?
DistanceToSurfaceRelative?
CameraNameName of camera being used (must correspond to one of the cameras known to QGroundControl or: Manual (no camera specs) for manual setup, Custom Camera for a custom setup. The keys listed after this point are not specified for a "Manual" camera definition.
FixedOrientation? (boolean)
FocalLengthFocal length of camera lens in millimeters.
FrontalOverlapPercentage of frontal image overlap.
ImageDensity?
ImageHeightImage height in px
ImageWidthImage width in px
Landscapetrue: Camera installed in landscape orientation on vehicle, false: Camera installed in portrait orientation on vehicle.
MinTriggerInterval?
SensorHeightSensor height in millimeters.
SensorWidthSensor width in millimeters.
SideOverlapPercentage of side image overlap.
ValueSetIsDistance? (boolean)

GeoFence ​

The geoFence object is required, but its circles and polygons lists may be empty. The plan can contain an arbitrary number of geofences defined in terms of polygons and circles.

The minimal definition is shown below.

json
    "geoFence": {
        "circles": [
        ],
        "polygons": [
        ],
        "version": 2
    },

The fields are:

KeyDescription
versionThe version number for the geofence plan format. The documented version is 2.
circlesList containing circle geofence definitions (comma separated).
polygonsList containing polygon geofence definitions (comma separated).

Circle Geofence ​

Each circular geofence is defined in a separate item, as shown below (multiple comma-separated items can be defined). The items define the centre and radius of the circle, and whether it is an inclusion or exclusion fence.

json
{
  "circle": {
    "center": [47.39756763610029, 8.544649762407738],
    "radius": 319.85
  },
  "inclusion": true,
  "version": 1
}

The fields are:

KeyDescription
versionThe version number for the geofence "circle" plan format. The documented version is 1.
circleThe definition of the circle. Includes centre (latitude, longitude) and radisu as shown above.
inclusiontrue: inclusion fence; false: exclusion fence.

Polygon Geofence ​

Each polygon geofence is defined in a separate item, as shown below (multiple comma-separated items can be defined). The geofence includes a set of points defined with a clockwise winding (i.e. they must enclose an area).

json
            {
                "inclusion": true,
                "polygon": [
                    [
                        47.39807773798406,
                        8.543834631785785
                    ],
                    [
                        47.39983519888905,
                        8.550024648373267
                    ],
                    [
                        47.39641100087146,
                        8.54499282423751
                    ],
                    [
                        47.395590322265186,
                        8.539435808992085
                    ]
                ],
                "version": 1
            }
        ],
        "version": 2
    }

The fields are:

KeyDescription
versionThe version number for the geofence "polygon" plan format. The documented version is 2.
polygonA list of points for the polygon. Each point contains a latitude and longitude. The points are ordered in a clockwise winding.
inclusiontrue: inclusion fence; false: exclusion fence.

Rally Points ​

The rallyPoints object is required, but its points list may be empty. The plan can contain an arbitrary number of rally points, each of which has a latitude, longitude, altitude and altitude frame. What the altitude means to the vehicle depends on the firmware: PX4 uses it as the ground altitude at the rally point, ArduPilot uses it as a flight altitude.

A definition with two points is shown below.

json

    "rallyPoints": {
        "points": [
            {
                "coordinate": [
                    47.39760401,
                    8.5509154,
                    50
                ],
                "frame": 3
            },
            {
                "coordinate": [
                    47.39902017,
                    8.54263274,
                    510.5
                ],
                "frame": 0
            }
        ],
        "version": 3
    }

The fields are:

KeyDescription
versionThe version number for the rally point plan format. The documented version is 3. Version 2 files, where each point is a [latitude, longitude, altitude] array, are still loaded and are relative to home.
pointsA list of rally point objects.

Each rally point object has these fields:

KeyDescription
coordinate[latitude, longitude, altitude]. The altitude is in meters in the frame given by frame.
frameThe MAV_FRAME of the altitude: 3 (MAV_FRAME_GLOBAL_RELATIVE_ALT) relative to home, 0 (MAV_FRAME_GLOBAL) above mean sea level, 10 (MAV_FRAME_GLOBAL_TERRAIN_ALT) above terrain.