Geofence

class mavsdk.geofence.Geofence(async_plugin_manager)

Bases: mavsdk._base.AsyncBase

Enable setting a geofence.

Generated by dcsdkgen - MAVSDK Geofence API

name = 'Geofence'
async upload_geofence(polygons)

Upload a geofence.

Polygons are uploaded to a drone. Once uploaded, the geofence will remain on the drone even if a connection is lost.

Parameters

polygons ([Polygon]) – Polygon(s) representing the geofence(s)

Raises

GeofenceError – If the request fails. The error contains the reason for the failure.

exception mavsdk.geofence.GeofenceError(result, origin, *params)

Bases: Exception

Raised when a GeofenceResult is a fail code

class mavsdk.geofence.GeofenceResult(result, result_str)

Bases: object

Result type.

Parameters
  • result (Result) – Result enum value

  • result_str (std::string) – Human-readable English string describing the result

class Result(value)

Bases: enum.Enum

Possible results returned for geofence requests.

UNKNOWN

Unknown result

SUCCESS

Request succeeded

ERROR

Error

TOO_MANY_GEOFENCE_ITEMS

Too many Polygon objects in the geofence

BUSY

Vehicle is busy

TIMEOUT

Request timed out

INVALID_ARGUMENT

Invalid argument

BUSY = 4
ERROR = 2
INVALID_ARGUMENT = 6
SUCCESS = 1
TIMEOUT = 5
TOO_MANY_GEOFENCE_ITEMS = 3
UNKNOWN = 0
class mavsdk.geofence.Point(latitude_deg, longitude_deg)

Bases: object

Point type.

Parameters
  • latitude_deg (double) – Latitude in degrees (range: -90 to +90)

  • longitude_deg (double) – Longitude in degrees (range: -180 to +180)

class mavsdk.geofence.Polygon(points, fence_type)

Bases: object

Polygon type.

Parameters
  • points ([Point]) – Points defining the polygon

  • fence_type (FenceType) – Fence type

class FenceType(value)

Bases: enum.Enum

Geofence polygon types.

INCLUSION

Type representing an inclusion fence

EXCLUSION

Type representing an exclusion fence

EXCLUSION = 1
INCLUSION = 0