Geofence

class mavsdk.geofence.Circle(point, radius, fence_type)

Bases: object

Circular type.

Parameters:
  • point (Point) – Point defining the center

  • radius (float) – Radius of the circular fence

  • fence_type (FenceType) – Fence type

class mavsdk.geofence.FenceType(value)

Bases: Enum

Geofence types.

Values

INCLUSION

Type representing an inclusion fence

EXCLUSION

Type representing an exclusion fence

EXCLUSION = 1
INCLUSION = 0
class mavsdk.geofence.Geofence(async_plugin_manager)

Bases: AsyncBase

Enable setting a geofence.

Generated by dcsdkgen - MAVSDK Geofence API

async clear_geofence()

Clear all geofences saved on the vehicle.

Raises:

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

name = 'Geofence'
async upload_geofence(geofence_data)

Upload geofences.

Polygon and Circular geofences are uploaded to a drone. Once uploaded, the geofence will remain on the drone even if a connection is lost.

Parameters:

geofence_data (GeofenceData) – Circle(s) and/or Polygon(s) representing the geofence(s)

Raises:

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

class mavsdk.geofence.GeofenceData(polygons, circles)

Bases: object

Geofence data type.

Parameters:
  • polygons ([Polygon]) – Polygon(s) representing the geofence(s)

  • circles ([Circle]) – Circle(s) representing the geofence(s)

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

Possible results returned for geofence requests.

Values

UNKNOWN

Unknown result

SUCCESS

Request succeeded

ERROR

Error

TOO_MANY_GEOFENCE_ITEMS

Too many objects in the geofence

BUSY

Vehicle is busy

TIMEOUT

Request timed out

INVALID_ARGUMENT

Invalid argument

NO_SYSTEM

No system connected

BUSY = 4
ERROR = 2
INVALID_ARGUMENT = 6
NO_SYSTEM = 7
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