Mission Planning and Management Tutorial
When the unmanned aerial vehicle needs to operate independently, we will use the planning of airline route missions and the management of airline route missions. The planning of airline route missions is to generate airline route mission files according to certain rules; the management of airline route missions is to upload, execute, pause, resume, etc. the planned airline route files through MSDK, and at the same time monitor various states of the execution of airline route missions.
KMZ airline route mission file
From firmware version 1.8 of Autel drones, KMZ mission files are supported. KMZ is a compressed document in ZIP format, with the file extension ".kmz", including resource files (res directory), template files (template.kml), and execution files (waylines.wpml). Both the KML and WPML files are in the standard XML format for easy reading and editing. The document structure of the KMZ file after decompression is as follows:
waypoints_mission_file_name.kmz
└── wpmz
├── res // resource file
├── template.kml // template file
└── waylines.wpml // execution file
1.For more information about template.kml and waylines.wpml, please refer to the detailed explanation of the KMZ format standard. As a standard mission file, the KMZ mission file has been supported by third-party drones or third-party mapping software.
2.Tasks can be planned in the Autel Enterprise APP version 2.x and then the KMZ files can be exported and saved.
3.You can refer to the Demo for assembling KMZ files.
Ⅰ、Task Planning Process.
Ⅱ、 Mission Management
1. Waypoint Mission Manager
We control the execution of mission through the MissionManager.
val missionManager = DeviceManager.getDeviceManager().getFirstDroneDevice()?.getWayPointMissionManager()
2.Mission Upload
Upload KMZ mission file.
missionManager.uploadKmzMissionFile(
kmzPath: String,
guid: Int,
callback: CommonCallbacks.CompletionCallbackWithProgressAndParam<Long>)
3.Start Mission
missionManager.startMission(
guidBean: MissionKmlGUIDBean,
callback:CommonCallbacks.CompletionCallbackWithParam<Void>)
4.Pause Mission
missionManager.pauseMission(
callback : CommonCallbacks.CompletionCallbackWithParam<Void>,
isKml: Boolean = true)
5.Resume Mission
missionManager.resumeMission(
guidBean: MissionKmlGUIDBean,
callback: CommonCallbacks.CompletionCallbackWithParam<Void>)
6.Stop Mission
missionManager.exitMission(
callback: CommonCallbacks.CompletionCallbackWithParam<Void>
isKml: Boolean = true)
7.Mission Status Monitoring / Cancel Monitoring
missionManager.addWaypointMissionExecuteStateListener(
listener: CommonCallbacks.KeyListener<MissionWaypointStatusReportNtfyBean>)
missionManager.removeWaypointMissionExecuteStateListener(
listener: CommonCallbacks.KeyListener<MissionWaypointStatusReportNtfyBean>)
//Monitor the mission execution of all aircraft at one time in the case of multiple aircraft.
private val reportKey = KeyTools.createKey(FlightMissionKey.KeyStatusReportNtfy)
DeviceManager.getDeviceManager().addDroneDevicesListener(reportKey, devicesListener)
DeviceManager.getDeviceManager().removeDroneDevicesListener(reportKey, devicesListener)
private val devicesListener = object : DeviceManager.KeyManagerListenerCallBack {
override fun onListenerValueChanged(value: DeviceManager.DeviceListenerResult<*>) {
val device = value.drone
val reportBean = value.result as MissionWaypointStatusReportNtfyBean
}
}
8.Query Breakpoint Mission Information
missionManager.queryMissionBreakpointInfo(
param: MissionWaypointGUIDBean,
callback: CommonCallbacks.CompletionCallbackWithParam<MissionWaypointBreakRspBean>)
9.Resume Breakpoint Mission
missionManager.resumeBreakpointMission(
guiBean: MissionKmlGUIDBean,
callback: CommonCallbacks.CompletionCallbackWithParam<MissionWaypointBreakRspBean>)
三、Reference Sample
The code for route task management and execution can be found in Sample #MissionDemoFragment.