No-Fly Zone Unlock Tutorial
No-Fly Zone Unlock Tutorial
1. Overview
The no-fly zone unlock feature provides developers with the ability to monitor changes in no-fly zones near the aircraft. Through no-fly zone unlocking, you can obtain no-fly zones within a specific kilometer range around the aircraft and unlock designated areas. After unlocking, there will be no more no-fly zone prompts and aircraft takeoff restrictions will be lifted.
2. No-Fly Zone Classification
MSDK classifies no-fly zones in Fly Zone Policy Enumeration - FlyZoneCategory:
No-Fly Zone Type | Description |
---|---|
WARNING | Warning Zone |
ENHANCED_WARNING | Enhanced Warning Zone |
AUTHORIZATION | Authorization Zone |
RESTRICTED | Restricted Zone |
HEIGHT_RESTRICTED | Height Restricted Zone |
Note:
- If the aircraft encounters a no-fly zone during flight or exceeds the height restricted zone, the aircraft will hover before the zone and cannot be controlled to move forward in that direction.
3. No-Fly Zone Retrieval
Use getFlyZonesInSurroundingArea() to get no-fly zones within a 100-kilometer radius from the center location, including fixed no-fly zones, temporary no-fly zones, and geofences;
Use getFixedNoFlyZone() to get fixed no-fly zones within a 100-kilometer radius from the center location;
Use getTempNoFlyZone() to get temporary no-fly zones within a 100-kilometer radius from the center location;
Use getImportNoFlyZone() to get geofences imported into the SDK.
Note:
- If there are too many no-fly zones retrieved, displaying them on the map may cause performance issues. It is recommended to optimize the display accordingly.
4. No-Fly Zone Unlock Process
The following describes the steps for no-fly zone unlocking.
Get nearby no-fly zones using the interfaces described in No-Fly Zone Retrieval
Apply for authorization zones through after-sales service.
Use downloadAuthFlyZoneFromServer() to retrieve authorization zones from the server. You can get authorization zones for specific aircraft using the aircraft serial number.
Use writeNoFlyZoneFile() to write no-fly zone and authorization zone information to an Autel format file
Use uploadNoFlyZoneToAircraft() to upload the file to the aircraft with the same SN as the current aircraft. The authorization zone settings will take effect after successful import.
Use getAuthFlyZone() to retrieve locally stored unlock information.
5. Interface Call Flow
The following diagram shows an example of the no-fly zone unlock interface call flow. You don't need to follow every step - please call according to your actual needs. For detailed usage, please refer to the IFlyZoneManager class in the MSDK API documentation.
6. Interface Call Instructions
6.1 Get No-Fly Zones Within 100 Kilometers of Aircraft
Example code:
FlyZoneManager.get().getFlyZonesInSurroundingArea(location, object: CommonCallbacks.CompletionCallbackWithParam<List<FlyZoneInformation>?>{
override fun onSuccess(t: List<FlyZoneInformation>?) {
//success
}
override fun onFailure(error: IAutelCode, msg: String?) {
//failure
}
})
Parameter description:
location: Location information LocationCoordinate2D
You can get fixed no-fly zones, temporary no-fly zones, and geofences at once, or use other interfaces to get them separately. As shown below:
//Get fixed no-fly zones
FlyZoneManager.get().getFixedNoFlyZone(location, object: CommonCallbacks.CompletionCallbackWithParam<List<FlyZoneInformation>?>{
override fun onSuccess(t: List<FlyZoneInformation>?) {
//success
}
override fun onFailure(error: IAutelCode, msg: String?) {
//failure
}
})
//Get temporary no-fly zones
FlyZoneManager.get().getTempNoFlyZone(location, object: CommonCallbacks.CompletionCallbackWithParam<List<FlyZoneInformation>?>{
override fun onSuccess(t: List<FlyZoneInformation>?) {
//success
}
override fun onFailure(error: IAutelCode, msg: String?) {
//failure
}
})
//Get imported geofences
FlyZoneManager.get().getImportNoFlyZone(location, object: CommonCallbacks.CompletionCallbackWithParam<List<FlyZoneInformation>?>{
override fun onSuccess(t: List<FlyZoneInformation>?) {
//success
}
override fun onFailure(error: IAutelCode, msg: String?) {
//failure
}
})
6.2 Get Aircraft Authorization Zone Information from Server
Example code:
FlyZoneManager.get().downloadAuthFlyZoneFromServer(
aircraftSN,
location,
object: CommonCallbacks.CompletionCallbackWithParam<List<FlyZoneAuthInformation>?>{
override fun onSuccess(t: List<FlyZoneAuthInformation>?) {
//success
}
override fun onFailure(error: IAutelCode, msg: String?) {
//failure
}
})
Parameter description:
aircraftSN: Aircraft serial number
location: Center location LocationCoordinate2D
6.3 Write No-Fly Zones and Authorization Zones to File
Example code:
FlyZoneManager.get().writeNoFlyZoneFile(filePath, fileType, flyZoneInformation, authZoneInformation, object: CommonCallbacks.CompletionCallback<{
override fun onSuccess() {
//success
}
override fun onFailure(error: IAutelCode, msg: String?) {
//failure
}
})
Parameter description:
filePath: File save path
fileType: File type FileTypeEnum
flyZoneInformation: No-fly zone information FlyZoneInformation
authZoneInformation: Authorization zone information FlyZoneAuthInformation
6.4 Upload No-Fly Zone File to Aircraft
Example code:
FlyZoneManager.get().uploadNoFlyZoneToAircraft(filePath, aircraftSN, fileType, object: CommonCallbacks.UpLoadFileCallbackWithProgress<Int>{
override fun onStartUploading() {
//start uploading
}
override fun onProgressUpdate(progress: Int) {
// progress info
}
override fun onSuccess() {
// success
}
override fun onFailure(error: IAutelCode) {
//failure
}
})
Parameter description:
filePath: File save path
aircraftSN: Aircraft serial number
fileType: File type FileTypeEnum
Note:
The authorization zone information SN must match the aircraft SN, otherwise the upload will fail. The authorization zone will take effect after successful upload.
Aircraft already has built-in fixed no-fly zones, no need to upload
Currently, Autel fixed-wing aircraft combines temporary no-fly zones, geofences, and authorized zones into one file for upload
Autel fixed-wing aircraft can only use FileTypeEnum.ELECTRIC_BARRIER type for upload
Uploading the same file type will overwrite the previous file
6.4 Get Authorization Zone Information
Example code:
FlyZoneManager.get().getAuthFlyZone(device.getDroneSn()!!, object: CommonCallbacks.CompletionCallbackWithParam<List<FlyZoneAuthInformation>?>{
override fun onSuccess(t: List<FlyZoneAuthInformation>?) {
//success
}
override fun onFailure(error: IAutelCode, msg: String?) {
// failure
}
})
6.5 Import Geofence
Example code:
FlyZoneManager.get().importFlySafeDynamicDatabaseToMSDK(filePath, object: CommonCallbacks.CompletionCallbackWithParam<List<FlyZoneInformation>> {
override fun onSuccess(t: List<FlyZoneInformation>?) {
//success
}
override fun onFailure(error: IAutelCode, msg: String?) {
//failure
}
})
Parameter description:
filePath: File path
Note: Currently only EU geofencing data is supported. Geofencing data can be downloaded from the European Union Aviation Safety Agency website.
For more interface details, please refer to IFlyZoneManager