DJI Mobile SDK Documentation

      class DJIWaypointMissionOperator

      @interface DJIWaypointMissionOperator : NSObject
      Header:DJIWaypointMissionOperator.h
      Inherits From:NSObject
      Description:

      The waypoint operator is the only object that controls, runs and monitors Waypoint Missions. It can be accessed from DJIMissionControl.

      Class Members:

      Preparation

      Operator
      method
      method loadMission
      -(NSError * _Nullable)loadMission:(DJIWaypointMission *)mission
      Header:DJIWaypointMissionOperator.h
      Description:

      Loads a waypoint mission into the operator. A mission can be loaded only when the DJIWaypointMissionState is one of the following:

      Calling loadMission when the current state is DJIWaypointMissionStateReadyToExecute will change the state to DJIWaypointMissionStateReadyToUpload. After calling loadMission, latestExecutionProgress will be reset to nil.

      Input Parameters:
      DJIWaypointMission * missionWaypoint mission to load.
      Return:
      NSError * _NullableReturns an error when mission data is invalid or the mission cannot be loaded in the current state.
      property loadedMission
      @property (readonly, nonatomic, nullable) DJIWaypointMission *loadedMission
      Header:DJIWaypointMissionOperator.h
      Description:

      Gets the currently loaded mission of the operator. 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 operator 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 downloadMissionWithCompletion to get all the information for the loaded mission. The loadedMission will be reset to nil when the execution of the loadedMission is stopped, finished or interrupted.

      See Also:

      DJIWaypointMission

      Get Previous Interruption
      method
      method getPreviousInterruptionWithCompletion
      - (void)getPreviousInterruptionWithCompletion:(void(^)(DJIWaypointMissionInterruption *_Nullable interruption, NSError *_Nullable error))completion
      Header:DJIWaypointMissionOperator.h
      Description:

      Gets the interruption of the last waypoint mission. If a waypoint mission is interrupted before the completion, the aircraft will record the interruption information. This information is only available when the last waypoint mission is incomplete and the first waypoint of the mission has been reached. The interruption will also be recorded if the mission is stopped by the user. The interruption information is recorded in the aircraft and the information persists even after the aircraft's reboot.

      Input Parameters:
      DJIWaypointMissionInterruption *_Nullable interruptionThe interruption information to get. Returns NULL if there is any error.
      NSError *_Nullable errorError retrieving the value.
      void(^)(DJIWaypointMissionInterruption *_Nullable interruption, NSError *_Nullable error) completionCompletion block to receive the result.
      Mission Upload to Aircraft
      method
      method uploadMissionWithCompletion
      - (void)uploadMissionWithCompletion:(DJICompletionBlock)completion
      Header:DJIWaypointMissionOperator.h
      Description:

      Starts to upload the loadedMission to the aircraft. It can only be called when the loadedMission is complete and the currentState is DJIWaypointMissionStateReadyToUpload. 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 DJIWaypointMissionState will become DJIWaypointMissionStateReadyToExecute.

      Input Parameters:
      DJICompletionBlock completionCompletion block that will be called when the upload operation succeeds or fails to start. If it is started successfully, use addListenerToUploadEvent:withQueue:andBlock to receive the detailed progress.
      Mission Download from Aircraft
      method
      method downloadMissionWithCompletion
      - (void)downloadMissionWithCompletion:(DJICompletionBlock)completion
      Header:DJIWaypointMissionOperator.h
      Description:

      Downloads information of each waypoint from aircraft and save it to loadedMission. If a download operation is started, the operator will download the information of waypoints missing in loadedMission one-by-one in ascending order. If loadedMission is already complete (containing all the waypoints), this method will call completion immediately without error. It can only be called when the currentState is one of the following: - DJIWaypointMissionStateExecuting - DJIWaypointMissionStateExecutionPaused

      Input Parameters:
      DJICompletionBlock completionCompletion block that will be called when the download operation succeeds or fails to start. If it is started successfully, use addListenerToDownloadEvent:withQueue:andBlock to receive the detailed progress.


      Mission Execution

      method startMissionWithCompletion
      - (void)startMissionWithCompletion:(DJICompletionBlock)completion
      Header:DJIWaypointMissionOperator.h
      Description:

      Starts the execution of the uploaded mission. It can only be called when the currentState is DJIWaypointMissionStateReadyToExecute. After a mission is started successfully, the currentState will become DJIWaypointMissionStateExecuting.

      Input Parameters:
      DJICompletionBlock completionCompletion block that will be called when the operator succeeds or fails to start the execution. If it fails, an error will be returned.
      method resumeMissionWithCompletion
      - (void)resumeMissionWithCompletion:(DJICompletionBlock)completion
      Header:DJIWaypointMissionOperator.h
      Description:

      Resumes the paused mission. It can only be called when the currentState is DJIWaypointMissionStateExecutionPaused. After a mission is resumed successfully, the currentState will become DJIWaypointMissionStateExecuting.

      Input Parameters:
      DJICompletionBlock completionCompletion block that will be called when the operator succeeds or fails to resume the mission. If it fails, an error will be returned.
      method pauseMissionWithCompletion
      - (void)pauseMissionWithCompletion:(DJICompletionBlock)completion
      Header:DJIWaypointMissionOperator.h
      Description:

      Pauses the executing mission. It can only be called when the DJIWaypointMissionState is DJIWaypointMissionStateExecuting. After a mission is paused successfully, the currentState will become DJIWaypointMissionStateExecutionPaused.

      Input Parameters:
      DJICompletionBlock completionCompletion block that will be called when the operator succeeds or fails to pause the mission. If it fails, an error will be returned.
      method stopMissionWithCompletion
      - (void)stopMissionWithCompletion:(DJICompletionBlock)completion
      Header:DJIWaypointMissionOperator.h
      Description:

      Stops the executing or paused mission. It can only be called when the currentState is one of the following: - DJIWaypointMissionStateExecuting - DJIWaypointMissionStateExecutionPaused After a mission is stopped successfully, currentState will become DJIWaypointMissionStateReadyToUpload.

      Input Parameters:
      DJICompletionBlock completionCompletion block that will be called when the operator succeeds or fails to stop the mission. If it fails, an error will be returned.
      Auto flight speed
      method
      method setAutoFlightSpeed:withCompletion
      - (void)setAutoFlightSpeed:(float)speed withCompletion:(DJICompletionBlock)completion
      Header:DJIWaypointMissionOperator.h
      Description:

      Set the flight speed while the mission is executing automatically (without manual joystick speed input). This is the only property or method in this class that can communicate with the aircraft during a mission. All other properties and methods are used offline to prepare the mission which is then uploaded to the aircraft.

      Input Parameters:
      float speedAuto flight speed to be set. The absolute value of the auto flight speed should be less than or equal to the maxFlightSpeed. Its range is [-maxFlightSpeed, maxFlightSpeed] m/s.
      DJICompletionBlock completionCompletion block.


      State

      Execution Progress
      property
      property latestExecutionProgress
      @property (readonly, nonatomic, nullable) DJIWaypointExecutionProgress *latestExecutionProgress
      Header:DJIWaypointMissionOperator.h
      Description:

      The latest execution progress cached by the operator. It will be reset to nil after loadMission is called.

      See Also:

      DJIWaypointExecutionProgress

      property
      property currentState
      @property (readonly, nonatomic) DJIWaypointMissionState currentState
      Header:DJIWaypointMissionOperator.h
      Description:

      The current state of the operator.

      See Also:

      DJIWaypointMissionState

      property latestUploadProgress
      @property (readonly, nonatomic, nullable) DJIWaypointUploadProgress *latestUploadProgress
      Header:DJIWaypointMissionOperator.h
      Description:

      The latest execution progress cached by the operator. It will be reset to nil after loadMission is called.

      See Also:

      DJIWaypointUploadProgress


      Listener

      method addListenerToUploadEvent:withQueue:andBlock
      - (void)addListenerToUploadEvent:(id)listener
      withQueue:(nullable dispatch_queue_t)queue
      andBlock:(DJIWaypointMissionOperatorUploadEventBlock)block
      Header:DJIWaypointMissionOperator.h
      Description:

      Adds listener to receive the event related to upload.

      Input Parameters:
      id listenerListener that is interested on upload event.
      nullable dispatch_queue_t queueThe dispatch queue that block will be called on.
      DJIWaypointMissionOperatorUploadEventBlock blockBlock will be called when there is event updated related to upload.
      method addListenerToDownloadEvent:withQueue:andBlock
      - (void)addListenerToDownloadEvent:(id)listener
      withQueue:(nullable dispatch_queue_t)queue
      andBlock:(DJIWaypointMissionOperatorDownloadEventBlock)block
      Header:DJIWaypointMissionOperator.h
      Description:

      Adds listener to receive the event related to download.

      Input Parameters:
      id listenerListener that is interested on download event.
      nullable dispatch_queue_t queueThe dispatch queue that block will be called on.
      DJIWaypointMissionOperatorDownloadEventBlock blockBlock will be called when there is event updated related to download.
      method addListenerToStarted:withQueue:andBlock
      - (void)addListenerToStarted:(id)listener
      withQueue:(nullable dispatch_queue_t)queue
      andBlock:(DJIWaypointMissionOperatorSimpleEventBlock)block
      Header:DJIWaypointMissionOperator.h
      Description:

      Adds listener to receive the notification when a waypoint mission is started.

      Input Parameters:
      id listenerListener that is interested on the start of waypoint mission.
      nullable dispatch_queue_t queueThe dispatch queue that block will be called on.
      DJIWaypointMissionOperatorSimpleEventBlock blockBlock will be called when a waypoint mission is started.
      method addListenerToExecutionEvent:withQueue:andBlock
      - (void)addListenerToExecutionEvent:(id)listener
      withQueue:(nullable dispatch_queue_t)queue
      andBlock:(DJIWaypointMissionOperatorExecutionEventBlock)block
      Header:DJIWaypointMissionOperator.h
      Description:

      Adds listener to receive the event related to execution.

      Input Parameters:
      id listenerListener that is interested on execution event.
      nullable dispatch_queue_t queueThe dispatch queue that block will be called on.
      DJIWaypointMissionOperatorExecutionEventBlock blockBlock will be called when there is event updated related to execution.
      method addListenerToFinished:withQueue:andBlock
      - (void)addListenerToFinished:(id)listener
      withQueue:(nullable dispatch_queue_t)queue
      andBlock:(DJICompletionBlock)block
      Header:DJIWaypointMissionOperator.h
      Description:

      Adds listener to receive the notification when a waypoint mission is finished.

      Input Parameters:
      id listenerListener that is interested on the finish of waypoint mission.
      nullable dispatch_queue_t queueThe dispatch queue that block will be called on.
      DJICompletionBlock blockBlock will be called when a waypoint mission is finished. If the mission is interrupted with an error, the error will be passed to the block.
      Remove
      method
      method removeListener
      - (void)removeListener:(id)listener
      Header:DJIWaypointMissionOperator.h
      Description:

      Removes listener. If the same listener is listening to multiple events and notifications (e.g. upload event and download event), it will not receive any update of them.

      Input Parameters:
      id listenerListener to be removed.
      method removeAllListeners
      - (void)removeAllListeners
      Header:DJIWaypointMissionOperator.h
      Description:

      Remove all listeners.

      method removeListenerOfStarted
      - (void)removeListenerOfStarted:(id)listener
      Header:DJIWaypointMissionOperator.h
      Description:

      Removes listener to stop listening to the notification that a mission is started.

      Input Parameters:
      id listenerListener to be removed.
      method removeListenerOfFinished
      - (void)removeListenerOfFinished:(id)listener
      Header:DJIWaypointMissionOperator.h
      Description:

      Removes listener to stop listening to the notification that a mission is finished.

      Input Parameters:
      id listenerListener to be removed.
      method removeListenerOfUploadEvents
      - (void)removeListenerOfUploadEvents:(id)listener
      Header:DJIWaypointMissionOperator.h
      Description:

      Removes listener to stop listening to upload events.

      Input Parameters:
      id listenerListener to be removed.
      method removeListenerOfDownloadEvents
      - (void)removeListenerOfDownloadEvents:(id)listener
      Header:DJIWaypointMissionOperator.h
      Description:

      Removes listener to stop listening to download events.

      Input Parameters:
      id listenerListener to be removed.
      method removeListenerOfExecutionEvents
      - (void)removeListenerOfExecutionEvents:(id)listener
      Header:DJIWaypointMissionOperator.h
      Description:

      Removes listener to stop listening to execution events.

      Input Parameters:
      id listenerListener to be removed.


      Completion Blocks
      typedef block
      typedef block DJIWaypointMissionOperatorExecutionEventBlock
      typedef void (^DJIWaypointMissionOperatorExecutionEventBlock)(DJIWaypointMissionExecutionEvent *event)
      Header:DJIWaypointMissionOperator.h
      Description:

      Block to receive the updated execution event.

      Input Parameters:
      DJIWaypointMissionExecutionEvent * eventThe updated execution event.
      typedef block DJIWaypointMissionOperatorSimpleEventBlock
      typedef void (^DJIWaypointMissionOperatorSimpleEventBlock)()
      Header:DJIWaypointMissionOperator.h
      Description:

      Block to receive the notification that a waypoint mission is started successfully.

      typedef block DJIWaypointMissionOperatorUploadEventBlock
      typedef void (^DJIWaypointMissionOperatorUploadEventBlock)(DJIWaypointMissionUploadEvent *event)
      Header:DJIWaypointMissionOperator.h
      Description:

      Block that receive the updated upload event.

      Input Parameters:
      DJIWaypointMissionUploadEvent * eventThe updated upload event.
      typedef block DJIWaypointMissionOperatorDownloadEventBlock
      typedef void (^DJIWaypointMissionOperatorDownloadEventBlock)(DJIWaypointMissionDownloadEvent *event)
      Header:DJIWaypointMissionOperator.h
      Description:

      Block to receive the updated download event.

      Input Parameters:
      DJIWaypointMissionDownloadEvent * eventThe updated download event.
      enum DJIWaypointMissionState
      typedef NS_ENUM(NSInteger, DJIWaypointMissionState)
      Header:DJIWaypointMissionOperator.h
      Description:

      All the possible state of DJIWaypointMissionOperator.

      Enum Members:
      DJIWaypointMissionStateNotSupportedThe connected product does not support waypoint mission.
      DJIWaypointMissionStateReadyToUploadThe aircraft is ready to upload a mission.
      DJIWaypointMissionStateUploadingThe uploading is started successfully. Detail information for each waypoint is being uploaded one by one.
      DJIWaypointMissionStateReadyToExecuteWaypoint mission is uploaded completely and the aircraft is ready to start the execution.
      DJIWaypointMissionStateExecutingThe execution is started successfully.
      DJIWaypointMissionStateExecutionPausedWaypoint mission is paused successfully. User can call resumeMissionWithCompletion to continue the execution.
      DJIWaypointMissionStateDisconnectedThe connection between the mobile device, remote controller and aircraft is broken.
      DJIWaypointMissionStateRecoveringThe connection between the mobile device, remote controller and aircraft is built-up. The operator is synchronizing the state from the aircraft.
      DJIWaypointMissionStateUnknownThe state of the operator is unknown. It is the initial state when the operator is just created.