DJI Mobile SDK Documentation

      class DJIMissionControl

      @interface DJIMissionControl : NSObject <DJIMissionControlTimelineElementFeedback>
      Header:DJIMissionControl.h
      Inherits From:NSObject
      Description:

      Mission Control handles execution of missions. Either single missions can be run through dedicated mission operators, or a series of missions and actions can be run serially using the Timeline.

      Mission operators look after execution of a single mission. A mission operator has APIs to control the mission (e.g. start, stop, pause etc.) and provides mission state through listeners.

      Mission Control's Timeline is made up of a series of Timeline elements which can be Waypoint missions, Hotpoint missions (through the Hotpoint action DJIHotpointAction) or objects that follow the DJIMissionControlTimelineElement protocol. DJIMissionAction is a Timeline element, with DJIAircraftYawAction and DJIGimbalAttitudeAction subclasses being examples of specific actions. If a mission is being executed in a Timeline, the mission operator can still be used to get state information of the mission as well as change mission execution parameters.

      Timeline elements can also have triggers (DJIMissionTrigger) associated with them. Triggers are separate objects that are run in parallel with a Timeline element. The trigger object is used to initiate actions if a set of criteria are met. For example, a trigger could be used to monitor battery level, and then initiate an action once a threshold is passed. Mission Control's Timeline is only supported by aircrafts. Handheld devices (e.g. OSMO) do not support this feature.

      The listening mechanism for Mission Control is block based. To listen to an event, a listener object and a block to execute when the event occurs is passed to Mission Control. The listener object is only used by Mission Control to keep track of whether it should execute the listener block or not. Mission Control would not execute the listener block if the listener object was removed from the listener pool.

      Mission Control is accessed from missionControl in DJISDKManager.

      Class Members:

      Mission Operators

      Waypoint Mission
      method
      method waypointMissionOperator
      - (DJIWaypointMissionOperator *)waypointMissionOperator
      Header:DJIMissionControl.h
      Description:

      Returns the operator for waypoint missions.

      Return:
      DJIWaypointMissionOperator *A Waypoint mission operator object.
      Hotpoint Mission
      method
      method hotpointMissionOperator
      - (DJIHotpointMissionOperator *)hotpointMissionOperator
      Header:DJIMissionControl.h
      Description:

      Returns the operator for Hotpoint missions.

      Return:
      DJIHotpointMissionOperator *A Hotpoint mission operator object.
      Follow Me Mission
      method
      method followMeMissionOperator
      - (DJIFollowMeMissionOperator *)followMeMissionOperator
      Header:DJIMissionControl.h
      Description:

      Returns the operator for Follow Me missions.

      Return:
      DJIFollowMeMissionOperator *A Follow Me mission operator object.
      ActiveTrack Mission
      method
      method activeTrackMissionOperator
      - (DJIActiveTrackMissionOperator *)activeTrackMissionOperator
      Header:DJIMissionControl.h
      Description:

      Returns the operator for ActiveTrack missions.

      Return:
      DJIActiveTrackMissionOperator *An ActiveTrack mission operator object.
      Tap Fly Mission
      method
      method tapFlyMissionOperator
      - (DJITapFlyMissionOperator *)tapFlyMissionOperator
      Header:DJIMissionControl.h
      Description:

      Returns the operator for TapFly missions.

      Return:
      DJITapFlyMissionOperator *A TapFly mission operator object.
      Panorama Mission
      method
      method panoramaMissionOperator
      - (DJIPanoramaMissionOperator *)panoramaMissionOperator
      Header:DJIMissionControl.h
      Description:

      Returns the operator for Panorama missions.

      Return:
      DJIPanoramaMissionOperator *A Panorama mission operator object.
      Intelligent Hotpoint Mission
      method
      method intelligentHotpointMissionOperator
      - (DJIIntelligentHotpointMissionOperator *)intelligentHotpointMissionOperator
      Header:DJIMissionControl.h
      Description:

      Returns the operator for Intelligent Hotpoint missions.

      Return:
      DJIIntelligentHotpointMissionOperator *An Intelligent Hotpoint mission operator object.


      Timeline

      Setup
      method
      method scheduleElement
      - (NSError * _Nullable)scheduleElement:(id <DJIMissionControlTimelineElement>)element
      Header:DJIMissionControl.h
      Description:

      Adds an element to the end of the Timeline.

      Input Parameters:
      id <DJIMissionControlTimelineElement> elementA DJIMissionControlTimelineElement element.
      Return:
      NSError * _NullableThe first error if one occurred.
      method scheduleElements
      - (NSError * _Nullable)scheduleElements:(NSArray <id <DJIMissionControlTimelineElement>> *)elements
      Header:DJIMissionControl.h
      Description:

      Adds an array of elements to the end of the Timeline.

      Input Parameters:
      NSArray <id <DJIMissionControlTimelineElement>> * elementsAn array of DJIMissionControlTimelineElement elements.
      Return:
      NSError * _NullableThe first error if one occurred. <code>userInfo</code> will hold a dictionary with two keys: @"element" -> holding the elemnt involved in the error and @"index" -> the index in the array for the element.
      method scheduleElement:atIndex
      - (NSError * _Nullable)scheduleElement:(id <DJIMissionControlTimelineElement>)element atIndex:(NSUInteger)index
      Header:DJIMissionControl.h
      Description:

      Insert an element into the Timeline at an index.

      Input Parameters:
      id <DJIMissionControlTimelineElement> elementA DJIMissionControlTimelineElement element
      NSUInteger indexThe element index to insert the new element before.
      Return:
      NSError * _NullableThe first error if one occurred.
      method unscheduleElement
      - (void)unscheduleElement:(id <DJIMissionControlTimelineElement>)element
      Header:DJIMissionControl.h
      Description:

      Remove element from the Timeline. If the same element was used more than once in the Timeline, then the first one will be removed.

      Input Parameters:
      id <DJIMissionControlTimelineElement> elementA DJIMissionControlTimelineElement element that is already in the Timeline.
      method unscheduleElementAtIndex
      - (void)unscheduleElementAtIndex:(NSUInteger)index
      Header:DJIMissionControl.h
      Description:

      Removes the Element at an index in the Timeline.

      Input Parameters:
      NSUInteger indexIndex of element to remove.
      method scheduledElementAtIndex
      - (nullable id)scheduledElementAtIndex:(NSUInteger)index
      Header:DJIMissionControl.h
      Description:

      Returns the element at a given index in the Timeline.

      Input Parameters:
      NSUInteger indexAn element index in the Timeline.
      Return:
      nullable idEither a mission, an element or nil if nothing was at the given index.
      method scheduledElementsCount
      - (NSUInteger)scheduledElementsCount
      Header:DJIMissionControl.h
      Description:

      Returns the number of elements within the Timeline.

      Return:
      NSUIntegerElement count.
      method indexOfScheduledElement
      - (NSUInteger)indexOfScheduledElement:(id <DJIMissionControlTimelineElement>)element
      Header:DJIMissionControl.h
      Description:

      Gets the index of an element among the scheduled elements.

      Input Parameters:
      id <DJIMissionControlTimelineElement> elementThe element whose index is to be returned.
      Return:
      NSUIntegerThe index of an element.
      method unscheduleEverything
      - (void)unscheduleEverything
      Header:DJIMissionControl.h
      Description:

      Clears the Timeline, removing all elements.

      Schedule Trigger
      method
      method scheduleTriggers
      - (void)scheduleTriggers:(NSArray <DJIMissionTrigger *> *)triggers
      Header:DJIMissionControl.h
      Description:

      Adds triggers to be living along the whole timeline.

      Input Parameters:
      NSArray <DJIMissionTrigger *> * triggersAn object of DJIMissionTrigger.
      method unscheduleTriggers
      - (void)unscheduleTriggers:(NSArray <DJIMissionTrigger *> *)triggers
      Header:DJIMissionControl.h
      Description:

      Clears all the triggers living along the whole timeline.

      Input Parameters:
      NSArray <DJIMissionTrigger *> * triggersAn object of DJIMissionTrigger.
      method scheduledTriggersCount
      - (NSUInteger)scheduledTriggersCount
      Header:DJIMissionControl.h
      Description:

      Return the triggers' count living along the whole timeline.

      Return:
      NSUIntegerAn NSUInteger value of scheduled Triggers Count.
      Control
      method
      method startTimeline
      - (void)startTimeline
      Header:DJIMissionControl.h
      Description:

      Start Timeline execution from the current element index currentTimelineMarker.

      method pauseTimeline
      - (void)pauseTimeline
      Header:DJIMissionControl.h
      Description:

      Pause execution of the Timeline, and current element (if pausible). If the current element is not pausible then this method will do nothing.

      method resumeTimeline
      - (void)resumeTimeline
      Header:DJIMissionControl.h
      Description:

      Resume element and Timeline execution.

      method stopTimeline
      - (void)stopTimeline
      Header:DJIMissionControl.h
      Description:

      Stops the execution of the Timeline, resets the marker index to 0.

      State
      property
      property isTimelineRunning
      @property (nonatomic, readonly) BOOL isTimelineRunning
      Header:DJIMissionControl.h
      Description:

      YES if the Timeline is running.

      property currentTimelineMarker
      @property (nonatomic) NSUInteger currentTimelineMarker
      Header:DJIMissionControl.h
      Description:

      The current element index in the Timeline that is being executed. This value can be set only when a Timeline is stopped (not executing or paused).

      property isTimelinePaused
      @property (nonatomic, readonly) BOOL isTimelinePaused
      Header:DJIMissionControl.h
      Description:

      YES if Timeline is paused.

      property runningElement
      @property (readonly, nonatomic, nullable) id <DJIMissionControlTimelineElement> runningElement
      Header:DJIMissionControl.h
      Description:

      The current element that is running in the Timeline. If the Timeline is not running, then this is nil.

      See Also:

      DJIMissionControlTimelineElement

      method addListener:toTimelineProgressWithBlock
      - (void)addListener:(id)listener toTimelineProgressWithBlock:(DJIMissionControlTimelineEventBlock)eventBlock
      Header:DJIMissionControl.h
      Description:

      Adds a listener to all Timeline events.

      Input Parameters:
      id listenerA listener object.
      DJIMissionControlTimelineEventBlock eventBlockA block to be called for each Timeline event
      method removeListener
      - (void)removeListener:(id)listener
      Header:DJIMissionControl.h
      Description:

      Removes the listener from the Timeline events listeners pool.

      Input Parameters:
      id listenerA previously added listener object.
      method removeAllListeners
      - (void)removeAllListeners
      Header:DJIMissionControl.h
      Description:

      Removes all listeners from the Timeline events listeners pool.


      Timeline Element
      protocol
      protocol DJIMissionControlTimelineElement
      @protocol DJIMissionControlTimelineElement <NSObject>
      Header:DJIMissionControl.h
      Inherits From:NSObject
      Description:

      Required behavior of elements that run in a Timeline.

      In addition to implementing this behavior, a Timeline element must communicate with Mission Control to let it know its state. Mission Control will wait for updates from the Timeline element before it itself progresses. Refer to DJIMissionControlTimelineElementFeedback for the methods Mission Control exposes for the Timeline element to use to communicate.

      Protocol Methods:
      Triggers
      method
      method triggers
      @optional
      - (NSArray <DJIMissionTrigger *> *)triggers
      Header:DJIMissionControl.h
      Description:

      If implemented, Mission Control loads and activates the triggers for the duration that the Timeline element is executing.

      Return:
      NSArray <DJIMissionTrigger *> *An array of DJIMissionTrigger object.
      Element Can be Paused
      method
      method isPausable
      @required
      - (BOOL)isPausable
      Header:DJIMissionControl.h
      Description:

      YES if the element can be paused. If NO, then when the Timeline is asked to pause when this element is running, nothing will happen.

      Return:
      BOOLYES if the element can be paused.
      Validation
      method
      method checkValidity
      @required
      - (NSError *_Nullable)checkValidity
      Header:DJIMissionControl.h
      Description:

      Returns an error if there is a configuration or parameter error in the element. Returns nil if there is no issue.

      Return:
      NSError *_NullableAn NSError object.
      Control
      method
      method willRun
      @optional
      - (void)willRun
      Header:DJIMissionControl.h
      Description:

      If Implemented, this is called by Mission Control right before running the element.

      method
      method run
      @required
      - (void)run
      Header:DJIMissionControl.h
      Description:

      Starts execution of Timeline element. Missions adopting this behavior are being run with their respective operators.

      method
      method pauseRun
      @optional
      - (void)pauseRun
      Header:DJIMissionControl.h
      Description:

      Pauses the execution of the element. Must be implemented if isPausable returns YES.

      method
      method resumeRun
      @optional
      - (void)resumeRun
      Header:DJIMissionControl.h
      Description:

      Resumes the execution of the element. Must be implemented if isPausable returns YES.

      method
      method stopRun
      @required
      - (void)stopRun
      Header:DJIMissionControl.h
      Description:

      Stops execution of the element.

      method
      method didRun
      @optional
      - (void)didRun
      Header:DJIMissionControl.h
      Description:

      Called after element execution, regardless of whether or not it was successful.

      Timeline Event
      typedef block
      typedef block DJIMissionControlTimelineEventBlock
      typedef void (^DJIMissionControlTimelineEventBlock)(DJIMissionControlTimelineEvent event, id <DJIMissionControlTimelineElement> _Nullable element, NSError *_Nullable error, id _Nullable info)
      Header:DJIMissionControl.h
      Description:

      Block used to process Timeline events.

      Input Parameters:
      id <DJIMissionControlTimelineElement> _Nullable elementThe Timeline element associated with the event, or nil if the event is global to the whole Timeline (e.g. start, finish the Timeline).
      DJIMissionControlTimelineEvent eventEvent.
      NSError *_Nullable errorThe optional error if the event was error-related.
      id _Nullable infoAn optional object containing additional information.
      enum DJIMissionControlTimelineEvent
      typedef NS_ENUM(NSInteger, DJIMissionControlTimelineEvent)
      Header:DJIMissionControl.h
      Description:

      Events that can initiate a call to the Mission Control listener.

      Enum Members:
      DJIMissionControlTimelineEventUnknownUnknown event type. This is a default value if no other event is matching.
      DJIMissionControlTimelineEventStartedTimeline successfully started.
      DJIMissionControlTimelineEventStartErrorTimeline failed to start.
      DJIMissionControlTimelineEventProgressedTimeline element progressed.
      DJIMissionControlTimelineEventPausedTimeline successfully paused.
      DJIMissionControlTimelineEventPauseErrorTimeline failed to be paused.
      DJIMissionControlTimelineEventResumedTimeline successfully resumed.
      DJIMissionControlTimelineEventResumeErrorTimeline failed to resume.
      DJIMissionControlTimelineEventStoppedTimeline Stopped successfully.
      DJIMissionControlTimelineEventStopErrorTimeline failed to stop and is still continuing in its previous state.
      DJIMissionControlTimelineEventFinishedTimeline completed its execution normally.
      protocol DJIMissionControlTimelineElementFeedback
      @protocol DJIMissionControlTimelineElementFeedback <NSObject>
      Header:DJIMissionControl.h
      Inherits From:NSObject
      Description:

      This protocol defines how the timeline element may contact mission control to notify it of its own execution. This protocol is not intended to be implemented by any other object and the use of a protocol is primarily organizational.

      Protocol Methods:

      Protocol Method

      method elementDidStartRunning
      required
      - (void)elementDidStartRunning:(id <DJIMissionControlTimelineElement>)element
      Header:DJIMissionControl.h
      Description:

      Used by elements to notify Mission Control of their successful start.

      Input Parameters:
      id <DJIMissionControlTimelineElement> elementA previously scheduled element. Should also be the element running.
      method element:failedStartingWithError
      required
      - (void)element:(id <DJIMissionControlTimelineElement>)element failedStartingWithError:(NSError *)error
      Header:DJIMissionControl.h
      Description:

      Used by elements to notify Mission Control of a failure preventing to start.

      Input Parameters:
      id <DJIMissionControlTimelineElement> elementA previously scheduled element. Should also be the element running.
      NSError * errorA valid error object.
      method element:progressedWithError
      required
      - (void)element:(id <DJIMissionControlTimelineElement>)element progressedWithError:(NSError * _Nullable)error
      Header:DJIMissionControl.h
      Description:

      Used by elements to notify Mission Control of a progress in the execution. Additional information may be pulled by mission control depending on the element. Calling this method with an error means the element is still running and the error did not cause it to stop.

      Input Parameters:
      id <DJIMissionControlTimelineElement> elementA previously scheduled element. Should also be the element running.
      NSError * _Nullable errorAn optional error if something went wrong.
      method elementDidPause
      required
      - (void)elementDidPause:(id <DJIMissionControlTimelineElement>)element
      Header:DJIMissionControl.h
      Description:

      Used by elements to notify Mission Control of a successful pausing.

      Input Parameters:
      id <DJIMissionControlTimelineElement> elementA previously scheduled element. Should also be the element running.
      method element:failedPausingWithError
      required
      - (void)element:(id <DJIMissionControlTimelineElement>)element failedPausingWithError:(NSError *)error
      Header:DJIMissionControl.h
      Description:

      Used by elements to notify Mission Control of a failure to pause. The element is expected to be still running.

      Input Parameters:
      id <DJIMissionControlTimelineElement> elementA previously scheduled element. Should also be the element running.
      NSError * errorA valid error object.
      method elementDidResume
      required
      - (void)elementDidResume:(id <DJIMissionControlTimelineElement>)element
      Header:DJIMissionControl.h
      Description:

      Used by elements to notify Mission Control of a successful resuming of a previously paused element.

      Input Parameters:
      id <DJIMissionControlTimelineElement> elementA previously scheduled element. Should also be the element running.
      method element:failedResumingWithError
      required
      - (void)element:(id <DJIMissionControlTimelineElement>)element failedResumingWithError:(NSError *)error
      Header:DJIMissionControl.h
      Description:

      Used by elements to notify Mission Control of a failure to resume. The element is expected to be still paused.

      Input Parameters:
      id <DJIMissionControlTimelineElement> elementA previously scheduled element. Should also be the element running.
      NSError * errorA valid error object.
      method element:didFinishRunningWithError
      required
      - (void)element:(id <DJIMissionControlTimelineElement>)element didFinishRunningWithError:(NSError * _Nullable)error
      Header:DJIMissionControl.h
      Description:

      Used by elements to notify Mission Control of the end of the execution of it.

      Input Parameters:
      id <DJIMissionControlTimelineElement> elementA previously scheduled element. Should also be the element running.
      NSError * _Nullable errorAn optional error if the execution end was the result of it.
      method elementDidStopRunning
      required
      - (void)elementDidStopRunning:(id <DJIMissionControlTimelineElement>)element
      Header:DJIMissionControl.h
      Description:

      Used by elements to notify Mission Control of their successful manual stop.

      Input Parameters:
      id <DJIMissionControlTimelineElement> elementA previously scheduled element. Should also be the element running.
      method element:failedStoppingWithError
      required
      - (void)element:(id <DJIMissionControlTimelineElement>)element failedStoppingWithError:(NSError *)error
      Header:DJIMissionControl.h
      Description:

      Used by elements to notify Mission Control of a failure to stop the execution of the element. This should only be used to handle error after stopRun is called.

      Input Parameters:
      id <DJIMissionControlTimelineElement> elementA previously scheduled element. Should also be the element running.
      NSError * errorA valid error object.
      const DJIMissionControlErrorDomain
      extern const NSErrorDomain DJIMissionControlErrorDomain
      Header:DJIMissionControl.h
      Description:

      The domain associated with errors specific to Mission Control.

      enum DJIMissionControlError
      typedef NS_ENUM(NSInteger, DJIMissionControlError)
      Header:DJIMissionControl.h
      Description:

      Defines all MissionControl related errors.

      Enum Members:
      DJIMissionControlErrorUnknownDefault placeholder when no other code matches.
      DJIMissionControlTimelineErrorCannotPauseUnpausableElementCan't pause an element which is not pausbile.
      DJIMissionControlTimelineErrorCannotScheduleWhileRunningTried to schedule new element while the Timeline was running.
      DJIMissionControlTimelineStartErrorAlreadyAtEndCan't start a timeline whose marker is already at the end.
      DJIMissionControlTimelineStartErrorAlreadyRunningCan't start a timeline which was already running.
      DJIMissionControlTimelineStartErrorTimelineIsPausedCan't start a paused timeline. Need to call resume instead.
      DJIMissionControlTimelinePauseErrorNotRunningCan't pause a timeline which is not running.
      DJIMissionControlTimelinePauseErrorAlreadyPausedCan't pause a timeline which is already paused.
      DJIMissionControlTimelineResumeErrorNotRunningCan't resume a timeline which is not running.
      DJIMissionControlTimelineResumeErrorNotPausedCan't resume a timeline which is not paused.
      DJIMissionControlTimelineErrorCannotResumeUnpausableElementCan't resume an element which is not pausbile.
      DJIMissionControlTimelineStopErrorNotRunningCan't stop a timeline which is not running.
      DJIMissionControlElementErrorProtocolNotConformElement passed does not conform to DJIMissionControlTimelineElement protocol
      DJIMissionControlElementErrorInvalidMissionOperatorThe element passed is a mission without a valid operator.
      DJIMissionControlElementErrorInvalidPauseImplementationIsPausable was set to yes but the item doesn't implement pauseRun and/or resumeRun methods.
      DJIMissionControlTimelineTriggerErrorActionNotImplementedTimeline trigger does not have an action implemented.