Skip to content

Plan File Format

Plan files are stored in JSON file format and contain mission items and (optional) geo-fence and rally-points. 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.
geoFence(Optional) Geofence information for this plan.
rallyPoints(Optional) Rally/Safe point information for this plan

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.

            {
                "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.

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

Complex items have these values associated with them:

KeyDescription
versionThe version number for this survey definition. Current version is 3.
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.

Corridor Scan

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

            {
                "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 3.
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.

                    "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

Geofence information is optional. 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 or not the specific geofence is activated.

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.
inclusionWhether or not the geofence is enabled (true) or disabled.

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.
inclusionWhether or not the geofence is enabled (true) or disabled.

Rally Points

Rally point information is optional. The plan can contain an arbitrary number of rally points, each of which has a latitude, longitude, and altitude (above home position).

A definition with two points is shown below.

json

    "rallyPoints": {
        "points": [
            [
                47.39760401,
                8.5509154,
                50
            ],
            [
                47.39902017,
                8.54263274,
                50
            ]
        ],
        "version": 2
    }

The fields are:

KeyDescription
versionThe version number for the rally point plan format. The documented version is 2.
pointsA list of rally points.