DJI Windows SDK Documentation

class WaypointMissionHandler

sealed class WaypointMissionHandler
Declaration:DJI.WindowsSDK.Mission.Waypoint
Description:

WaypointMissionHandler can be used to run and monitor Waypoint Missions. It can be accessed from WaypointMissionManager.

Class Members:

Preparation

Operator
method
method LoadMission
SDKError LoadMission(WaypointMission mission)
Declaration:DJI.WindowsSDK.Mission.Waypoint
Description:

Loads a waypoint mission into the device memory. A mission can be loaded only when the WaypointMissionState is one of the following:READY_TO_UPLOAD or READY_TO_EXECUTE. Calling LoadMission when the current state is READY_TO_EXECUTE will change the state to READY_TO_UPLOAD.

Input Parameters:
WaypointMission missionWaypoint mission to load.
Return:
SDKErrorThe operation error code. When mission data is invalid or the mission cannot be loaded in the current state, the value is PARAMETERS_SET_ERROR or INVALID_REQUEST_IN_CURRENT_STATE.
method GetLoadedMission
WaypointMission? GetLoadedMission()
Declaration:DJI.WindowsSDK.Mission.Waypoint
Description:

Gets the currently loaded mission of the manager. There are two ways to load a mission. 1. A mission can be loaded by user through loadMission. 2. If the aircraft is already executing a waypoint mission when SDK is re-connected, the manager will download part of the mission's information from the aircraft and load it automatically. In that case, the loaded mission will only contain the summary of the executing mission but information for each waypoint is absent. User can call DownloadMission to get all the information for the loaded mission. The loadedMission will be reset to null when the execution of the loadedMission is stopped, finished or interrupted.

Return:
WaypointMission?WaypointMission
Mission Upload to Aircraft
method
method UploadMission
async Task<SDKError> UploadMission()
Declaration:DJI.WindowsSDK.Mission.Waypoint
Description:

Starts to upload the GetLoadedMission to the aircraft. It can only be called when the GetCurrentState is READY_TO_UPLOAD. If a timeout error occurs during the previous upload, the upload operation will resume from the previous break-point. After a mission is uploaded successfully, the GetCurrentState will become READY_TO_EXECUTE.The upload progress will be notify by UploadStateChanged .

Return:
async Task<SDKError>The operation error code
method RetryUploadMission
async Task<SDKError> RetryUploadMission()
Declaration:DJI.WindowsSDK.Mission.Waypoint
Description:

Retry upload waypoint mission.

Return:
async Task<SDKError>The operation error code
Mission Download from Aircraft
method
method CancelUploadMission
async Task<SDKError> CancelUploadMission()
Declaration:DJI.WindowsSDK.Mission.Waypoint
Description:

Cancel upload mission . It can only be called when the GetCurrentState is UPLOADING

Return:
async Task<SDKError>The operation error code


Download

Mission Download from Aircraft
method
method DownloadMission
async Task<SDKError> DownloadMission()
Declaration:DJI.WindowsSDK.Mission.Waypoint
Description:

If app is restart and waypoint mission is executing,you need to download mission from aircraft. The operation will download information of each waypoint from aircraft and save it to GetLoadedMission. If a download operation is started, the manager will download the information of waypoints missing in GetLoadedMission one-by-one in ascending order. It can only be called when the GetCurrentState is one of the following: - EXECUTING - EXECUTE_PAUSED,The download progress will be notify by DownloadStateChanged .

Return:
async Task<SDKError>The operation error code
method RetryDownloadMission
async Task<SDKError> RetryDownloadMission()
Declaration:DJI.WindowsSDK.Mission.Waypoint
Description:

Retry downdownload waypoint mission.

Return:
async Task<SDKError>The operation error code
method CancelDownloadMission
async Task<SDKError> CancelDownloadMission()
Declaration:DJI.WindowsSDK.Mission.Waypoint
Description:

Cancel download mission.

Return:
async Task<SDKError>The operation error code


Mission Execution

Execution
method
method StartMission
async Task<SDKError> StartMission()
Declaration:DJI.WindowsSDK.Mission.Waypoint
Description:

Starts the execution of the uploaded mission. It can only be called when the GetCurrentState is READY_TO_EXECUTE. After a mission is started successfully, the GetCurrentState will become EXECUTING.

Return:
async Task<SDKError>The operation error code
method PauseMission
async Task<SDKError> PauseMission()
Declaration:DJI.WindowsSDK.Mission.Waypoint
Description:

Pauses the executing mission. It can only be called when the WaypointMissionState is EXECUTING. After a mission is paused successfully, the GetCurrentState will become EXECUTE_PAUSED.

Return:
async Task<SDKError>The operation error code
method ResumeMission
async Task<SDKError> ResumeMission()
Declaration:DJI.WindowsSDK.Mission.Waypoint
Description:

Resumes the paused mission. It can only be called when the GetCurrentState is EXECUTE_PAUSED. After a mission is resumed successfully, the GetCurrentState will become EXECUTING.

Return:
async Task<SDKError>The operation error code
method StopMission
async Task<SDKError> StopMission()
Declaration:DJI.WindowsSDK.Mission.Waypoint
Description:

Stops the executing or paused mission. It can only be called when the GetCurrentState is one of the following: - EXECUTING - EXECUTE_PAUSED After a mission is stopped successfully, GetCurrentState will become READY_TO_UPLOAD.

Return:
async Task<SDKError>The operation error code


State

method GetCurrentState
WaypointMissionState GetCurrentState()
Declaration:DJI.WindowsSDK.Mission.Waypoint
Description:

The current state of the manager.

Return:
WaypointMissionStateAn enum of WaypointMissionState
method GetLatestExecutionEvent
WaypointMissionExecutionState? GetLatestExecutionEvent()
Declaration:DJI.WindowsSDK.Mission.Waypoint
Description:

The latest execution event cached by the manager. It will be reset to null after LoadMission is called.

Return:
WaypointMissionExecutionState?return WaypointMissionExecutionState


Event

event UploadStateChanged
event UploadStateChangedEventHandler UploadStateChanged
Declaration:DJI.WindowsSDK.Mission.Waypoint
Description:

Receive the event related to upload mission. See UploadStateChangedEventHandler

event DownloadStateChanged
event DownloadStateChangedEventHandler DownloadStateChanged
Declaration:DJI.WindowsSDK.Mission.Waypoint
Description:

Receive the event related to download mission. See DownloadStateChangedEventHandler

event ExecutionStateChanged
event ExecutionStateChangedEventHandler ExecutionStateChanged
Declaration:DJI.WindowsSDK.Mission.Waypoint
Description:

Receive the event related to execution. See ExecutionStateChangedEventHandler

event StateChanged
event StateChangedEventHandler StateChanged
Declaration:DJI.WindowsSDK.Mission.Waypoint
Description:

Receive the event related to current state change.See StateChangedEventHandler

delegate DownloadStateChangedEventHandler
delegate void DownloadStateChangedEventHandler(WaypointMissionHandler sender, WaypointMissionDownloadState? value)
Declaration:DJI.WindowsSDK.Mission.Waypoint
Description:

Delegate of download state changed event.

delegate UploadStateChangedEventHandler
delegate void UploadStateChangedEventHandler(WaypointMissionHandler sender, WaypointMissionUploadState? value)
Declaration:DJI.WindowsSDK.Mission.Waypoint
Description:

Delegate of upload state changed event.

delegate ExecutionStateChangedEventHandler
delegate void ExecutionStateChangedEventHandler(WaypointMissionHandler sender, WaypointMissionExecutionState? value)
Declaration:DJI.WindowsSDK.Mission.Waypoint
Description:

Delegate of execution state changed event.

delegate StateChangedEventHandler
delegate void StateChangedEventHandler(WaypointMissionHandler sender, WaypointMissionStateTransition? value)
Declaration:DJI.WindowsSDK.Mission.Waypoint
Description:

Delegate of current state changed event.

property
property ProductIndex
uint ProductIndex { get; }
Declaration:DJI.WindowsSDK.Mission.Waypoint
Description:

The index of the product to which this component handler belongs. The default product index is 0.

struct WaypointMissionUploadState
struct WaypointMissionUploadState
Declaration:DJI.WindowsSDK
Description:

The upload state of a waypoint mission.

Struct Members:
bool isSummaryUploadedThe waypoint mission handler has uploaded the the mission's summary (information except waypoints).
int uploadedWaypointIndexThe index of the last uploaded waypoint. Information for each waypoint is uploaded one by one in ascending order. If no waypoint has been uploaded, the value will be -1.
int totalWaypointCountThe total count of waypoints in the waypoint mission.
int errorCodeThe encountered error during upload if there is any. Otherwise, it is null.
struct WaypointMissionDownloadState
struct WaypointMissionDownloadState
Declaration:DJI.WindowsSDK
Description:

The download state of a waypoint mission.

Struct Members:
int downloadedWaypointIndexThe index of the last downloaded waypoint. Information for each waypoint is downloaded one by one in ascending order. If no waypoint has been downloaded, the value will be -1.
int totalWaypointCountThe total count of waypoints in the waypoint mission.
int errorCodeThe encountered error during download if there is any. Otherwise, it is null.
struct WaypointMissionExecutionState
struct WaypointMissionExecutionState
Declaration:DJI.WindowsSDK
Description:

The execution state of a waypoint mission.

Struct Members:
int targetWaypointIndexIndex of the waypoint for the next mission to which the aircraft will proceed.
int totalWaypointCountThe total count of waypoints in the waypoint mission.
bool isWaypointReachedtrue when the aircraft reaches a waypoint. After the waypoint actions and heading change is complete, the targetWaypointIndex will increment and this property will become false.
bool isExecutionFinishIf the waypoint mission is finished.
WaypointMissionExecuteState stateThe current state of the waypoint mission handler.
int errorCodeThe encountered error during the execution if there is any. Otherwise, it is null.
struct WaypointMissionStateTransition
struct WaypointMissionStateTransition
Declaration:DJI.WindowsSDK
Description:

The state transition of the waypoint mission handler.

Struct Members:
WaypointMissionState previousThe previous state of the waypoint mission handler.
WaypointMissionState currentThe current state of the waypoint mission handler.
struct WaypointMission
struct WaypointMission
Declaration:DJI.WindowsSDK
Description:

In the waypoint mission, the aircraft will travel between waypoints, execute actions at waypoints, and adjust heading and altitude between waypoints. Waypoints are physical locations to which the aircraft will fly. Creating a series of waypoints, in effect, will program a flight route for the aircraft to follow. Actions can also be added to waypoints, which will be carried out when the aircraft reaches the waypoint. The aircraft travels between waypoints automatically at a base speed. However, the user can change the speed by using the pitch joystick. If the stick is pushed up, the speed will increase. If the stick is pushed down, the speed will slow down. The stick can be pushed down to stop the aircraft and further pushed to start making the aircraft travel back along the path it came. When the aircraft is travelling through waypoints in the reverse order, it will not execute waypoint actions at each waypoint. If the stick is released, the aircraft will again travel through the waypoints in the original order, and continue to execute waypoint actions (even if executed previously). If the aircraft is pulled back along the waypoint mission all the way to the first waypoint, then it will hover in place until the stick is released enough for it to again progress through the mission from start to finish.

Struct Members:
int waypointCountNumber of waypoints in the waypoint mission. Note there are some cases when the waypoint count will be different to the waypoint array length from waypoints. This is usually the case when the waypoint mission is still being downloaded from the aircraft and the mission object hasn't existed previously (e.g. when the mobile device is connected to an aircraft with a previously uploaded mission). In these cases, isComplete will return null.
double maxFlightSpeedWhile the aircraft is travelling between waypoints, you can offset its speed by using the throttle joystick on the remote controller. maxFlightSpeed is this offset when the joystick is pushed to maximum deflection. For example, If maxFlightSpeed is 10 m/s, then pushing the throttle joystick all the way up will add 10 m/s to the aircraft speed, while pushing down will subtract 10 m/s from the aircraft speed. If the remote controller stick is not at maximum deflection, then the offset speed will be interpolated between [0, maxFlightSpeed] with a resolution of 1000 steps. If the offset speed is negative, then the aircraft will fly backwards to previous waypoints. When it reaches the first waypoint, it will then hover in place until a positive speed is applied. maxFlightSpeed has a range of [2,15] m/s.
double autoFlightSpeedThe base automatic speed of the aircraft as it moves between waypoints with range [-15, 15] m/s. The aircraft's actual speed is a combination of the base automatic speed, and the speed control given by the throttle joystick on the remote controller. If autoFlightSpeed > 0: Actual speed is autoFlightSpeed + Joystick Speed (with combined max of double maxFlightSpeed)
If autoFlightSpeed = 0: Actual speed is controlled only by the remote controller joystick.
If autoFlightSpeed < 0 and the aircraft is at the first waypoint, the aircraft will hover in place until the speed is made positive by the remote controller joystick.
WaypointMissionFinishedAction finishedActionAction the aircraft will take when the waypoint mission is complete.
WaypointMissionHeadingMode headingModeHeading of the aircraft as it moves between waypoints. Default is AUTO.
WaypointMissionFlightPathMode flightPathModeThe path the aircraft follows between waypoints. The aircraft can either fly directly between waypoints in a straight line, or turn near a waypoint in the curve where the waypoint location defines a part of the curve.
WaypointMissionGotoFirstWaypointMode gotoFirstWaypointModeDefines how the aircraft will go to the first waypoint from its current position. Default is SAFELY.
bool exitMissionOnRCSignalLostEnabledDetermines whether the mission should stop when connection between the aircraft and remote controller is lost. Default is FALSE.
LocationCoordinate2D pointOfInterestAircraft heading will be fixed to the point of interest location during the waypoint mission. Used when WaypointMissionHeadingMode headingMode is TOWARD_POINT_OF_INTEREST.
bool gimbalPitchRotationEnabledTRUE if the gimbal pitch rotation can be controlled during the waypoint mission. When TRUE, double gimbalPitch in Waypoint is used to control gimbal pitch.
int repeatTimesMission execution can be repeated more than once. A value of 0 means the mission only executes once, and does not repeat. A value of 1 means the mission will execute a total of two times.
int missionIDThe mission ID assigned to the waypoint mission.
enum WaypointMissionGotoFirstWaypointMode
enum WaypointMissionGotoFirstWaypointMode
Declaration:DJI.WindowsSDK
Description:

This enum will determine the goto point mode while the drone executes the flight.

Enum Members:
SAFELYGo to the waypoint safely. The aircraft will rise to the same altitude of the waypoint if the current altitude is lower then the waypoint altitude. It then goes to the waypoint coordinate from the current altitude, and proceeds to the altitude of the waypoint.
POINT_TO_POINTGo to the waypoint from the current aircraft point to the waypoint directly.
UNKNOWNUnknown.
enum WaypointMissionState
enum WaypointMissionState
Declaration:DJI.WindowsSDK
Description:

All the possible state of waypoint mission handler.

Enum Members:
DISCONNECTEDThe connection between the mobile device, remote controller and aircraft is broken.
RECOVERINGThe connection between the mobile device, remote controller and aircraft is built-up. The operator is synchronizing the state from the aircraft.
NOT_SUPPORTEDThe connected product does not support waypoint mission.
READY_TO_UPLOADThe aircraft is ready to upload a mission.
UPLOADINGThe uploading is started successfully. Detail information for each waypoint is being uploaded one by one.
READY_TO_EXECUTEWaypoint mission is uploaded completely and the aircraft is ready to start the execution.
EXECUTINGThe execution is started successfully.
EXECUTE_PAUSEDWaypoint mission is paused successfully. User can call resume mission to continue the execution.
UNKNOWNThe state of the operator is unknown. It is the initial state when the handler is just created.
enum WaypointMissionExecuteState
enum WaypointMissionExecuteState
Declaration:DJI.WindowsSDK
Description:

Current waypoint mission state.

Enum Members:
INITIALIZINGWaypoint mission is initializing, which means the mission has started and the aircraft is going to the first waypoint.
MOVINGAircraft is currently moving toward the mission's next waypoint. This happens when the WaypointMissionFlightPathMode flightPathMode is set to NORMAL.
CURVE_MODE_MOVINGAircraft is currently moving. This happens when the WaypointMissionFlightPathMode flightPathMode is set to CURVED.
CURVE_MODE_TURNINGAircraft is currently turning. This happens when the WaypointMissionFlightPathMode flightPathMode is set to CURVED.
BEGIN_ACTIONAircraft has reached a waypoint, has rotated to the new heading and is now processing actions. This state will be called before the waypoint actions starts executing and will occur for each waypoint action.
DOING_ACTIONAircraft is at a waypoint and is executing an action.
FINISHED_ACTIONAircraft is at a waypoint and has finished executing the current waypoint action. This state occurs once for each waypoint action.
RETURN_TO_FIRST_POINTAircraft has returned to the first waypoint. This happens when the WaypointMissionFinishedAction finishedAction is set to GO_FIRST_WAYPOINT.
PAUSEDThe mission is currently paused by the user.
UNKNOWNUnknown.