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
method waypointMissionOperator
- (DJIWaypointMissionOperator *)waypointMissionOperator
Header: DJIMissionControl.h
Description:
Returns the operator for waypoint missions.
Return:
method hotpointMissionOperator
- (DJIHotpointMissionOperator *)hotpointMissionOperator
Header: DJIMissionControl.h
Description:
Returns the operator for Hotpoint missions.
Return:
method followMeMissionOperator
- (DJIFollowMeMissionOperator *)followMeMissionOperator
Header: DJIMissionControl.h
Description:
Returns the operator for Follow Me missions.
Return:
ActiveTrack Mission
method
method activeTrackMissionOperator
- (DJIActiveTrackMissionOperator *)activeTrackMissionOperator
Header: DJIMissionControl.h
Description:
Returns the operator for ActiveTrack missions.
Return:
method tapFlyMissionOperator
- (DJITapFlyMissionOperator *)tapFlyMissionOperator
Header: DJIMissionControl.h
Description:
Returns the operator for TapFly missions.
Return:
method panoramaMissionOperator
- (DJIPanoramaMissionOperator *)panoramaMissionOperator
Header: DJIMissionControl.h
Description:
Returns the operator for Panorama missions.
Return:
Intelligent Hotpoint Mission
method
method intelligentHotpointMissionOperator
- (DJIIntelligentHotpointMissionOperator *)intelligentHotpointMissionOperator
Header: DJIMissionControl.h
Description:
Returns the operator for Intelligent Hotpoint missions.
Return:
Timeline
method scheduleElement
- (NSError * _Nullable)scheduleElement:(id <DJIMissionControlTimelineElement>)element
Header: DJIMissionControl.h
Description:
Adds an element to the end of the Timeline.
Return:
NSError * _Nullable The 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.
Return:
NSError * _Nullable The 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.
Return:
NSError * _Nullable The 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.
method unscheduleElementAtIndex
- (void )unscheduleElementAtIndex:(NSUInteger )index
Header: DJIMissionControl.h
Description:
Removes the Element at an index in the Timeline.
NSUInteger index Index 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.
NSUInteger index An element index in the Timeline.
Return:
nullable id Either 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:
method indexOfScheduledElement
- (NSUInteger )indexOfScheduledElement:(id <DJIMissionControlTimelineElement>)element
Header: DJIMissionControl.h
Description:
Gets the index of an element among the scheduled elements.
Return:
NSUInteger The index of an element.
method unscheduleEverything
- (void )unscheduleEverything
Header: DJIMissionControl.h
Description:
Clears the Timeline, removing all elements.
method scheduleTriggers
- (void )scheduleTriggers:(NSArray <DJIMissionTrigger *> *)triggers
Header: DJIMissionControl.h
Description:
Adds triggers to be living along the whole timeline.
method unscheduleTriggers
- (void )unscheduleTriggers:(NSArray <DJIMissionTrigger *> *)triggers
Header: DJIMissionControl.h
Description:
Clears all the triggers living along the whole timeline.
method scheduledTriggersCount
- (NSUInteger )scheduledTriggersCount
Header: DJIMissionControl.h
Description:
Return the triggers' count living along the whole timeline.
Return:
NSUInteger An NSUInteger value of scheduled Triggers Count.
method startTimeline
Header: DJIMissionControl.h
Description:
Start Timeline execution from the current element index currentTimelineMarker
.
method 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
Header: DJIMissionControl.h
Description:
Resume element and Timeline execution.
method stopTimeline
Header: DJIMissionControl.h
Description:
Stops the execution of the Timeline, resets the marker index to 0.
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.
method removeListener
- (void )removeListener:(id )listener
Header: DJIMissionControl.h
Description:
Removes the listener from the Timeline events listeners pool.
id listener A previously added listener object.
method removeAllListeners
- (void )removeAllListeners
Header: DJIMissionControl.h
Description:
Removes all listeners from the Timeline events listeners pool.
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:
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:
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:
BOOL YES
if the element can be paused.
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 *_Nullable An NSError object.
method willRun
Header: DJIMissionControl.h
Description:
If Implemented, this is called by Mission Control right before running the element.
method run
Header: DJIMissionControl.h
Description:
Starts execution of Timeline element. Missions adopting this behavior are being run with their respective operators.
method pauseRun
@optional
- (void )pauseRun
Header: DJIMissionControl.h
Description:
Pauses the execution of the element. Must be implemented if isPausable
returns YES
.
method resumeRun
@optional
- (void )resumeRun
Header: DJIMissionControl.h
Description:
Resumes the execution of the element. Must be implemented if isPausable
returns YES
.
method stopRun
Header: DJIMissionControl.h
Description:
Stops execution of the element.
method 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.
id <DJIMissionControlTimelineElement > _Nullable element The Timeline element associated with the event, or nil
if the event is global to the whole Timeline (e.g. start, finish the Timeline). DJIMissionControlTimelineEvent event Event. NSError *_Nullable error The optional error if the event was error-related. id _Nullable info An 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.
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.
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.
id <DJIMissionControlTimelineElement > element A previously scheduled element. Should also be the element running. NSError * _Nullable error An 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.
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.
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.
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.
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.
id <DJIMissionControlTimelineElement > element A previously scheduled element. Should also be the element running. NSError * _Nullable error An 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.
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.
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.