DJI Mobile SDK Documentation

      class MissionControl

      class MissionControl implements TimelineElementFeedback, Triggerable
      Package:dji.sdk.mission
      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 HotpointAction) or objects that follow the TimelineElement protocol. MissionAction is a Timeline element, with AircraftYawAction and GimbalAttitudeAction 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 (Trigger) 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.

      > Mission Control is accessed from getMissionControl in DJISDKManager.

      Class Members:

      Mission Operators

      Waypoint Mission
      method
      method getWaypointMissionOperator
      @NonNull
      WaypointMissionOperator getWaypointMissionOperator()
      Package:dji.sdk.mission
      Description:

      Returns the operator for waypoint missions.

      Return:
      WaypointMissionOperatorA Waypoint mission operator object.
      Hotpoint Mission
      method
      method getHotpointMissionOperator
      @NonNull
      HotpointMissionOperator getHotpointMissionOperator()
      Package:dji.sdk.mission
      Description:

      Returns the operator for Hotpoint missions.

      Return:
      HotpointMissionOperatorA Hotpoint mission operator object.
      Follow Me Mission
      method
      method getFollowMeMissionOperator
      @NonNull
      FollowMeMissionOperator getFollowMeMissionOperator()
      Package:dji.sdk.mission
      Description:

      Returns the operator for Follow Me missions.

      Return:
      FollowMeMissionOperatorA Follow Me mission operator object.
      ActiveTrack Mission
      method
      method getActiveTrackOperator
      @NonNull
      ActiveTrackOperator getActiveTrackOperator()
      Package:dji.sdk.mission
      Description:

      Returns the operator for ActiveTrack missions.

      Return:
      ActiveTrackOperatorAn ActiveTrack mission operator object.
      Tap Fly Mission
      method
      method getTapFlyMissionOperator
      @NonNull
      TapFlyMissionOperator getTapFlyMissionOperator()
      Package:dji.sdk.mission
      Description:

      Returns the operator for TapFly missions.

      Return:
      TapFlyMissionOperatorA TapFly mission operator object.
      Panorama Mission
      method
      method getPanoramaMissionOperator
      @NonNull
      PanoramaMissionOperator getPanoramaMissionOperator()
      Package:dji.sdk.mission
      Description:

      Returns the operator for Panorama missions.

      Return:
      PanoramaMissionOperatorA Panorama mission operator object.
      Intelligent Hotpoint Mission
      method
      method getIntelligentHotpointMissionOperator
      @NonNull
      IntelligentHotpointMissionOperator getIntelligentHotpointMissionOperator()
      Package:dji.sdk.mission
      Description:

      Returns the operator for Intelligent Hotpoint missions.

      Return:
      IntelligentHotpointMissionOperatorAn Intelligent Hotpoint mission operator object.


      Timeline

      Setup
      method
      method scheduleElement
      DJIError scheduleElement(@NonNull TimelineElement element)
      Package:dji.sdk.mission
      Description:

      Adds an element to the end of the Timeline.

      Input Parameters:
      @NonNull TimelineElement elementA TimelineElement element.
      Return:
      DJIErrorThe first error if one occurred.
      method scheduleElements
      DJIError scheduleElements(@NonNull List<TimelineElement> elements)
      Package:dji.sdk.mission
      Description:

      Adds a list of elements to the end of the Timeline.

      Input Parameters:
      @NonNull List<TimelineElement> elementsA list of TimelineElement elements.
      Return:
      DJIErrorThe first error if one occurred.
      method scheduleElementAtIndex
      DJIError scheduleElementAtIndex(TimelineElement element, int index)
      Package:dji.sdk.mission
      Description:

      Insert an element into the Timeline at an index.

      Input Parameters:
      TimelineElement elementA TimelineElement element
      int indexThe element index to insert the new element before.
      Return:
      DJIErrorThe first error if one occurred.
      method unscheduleElement
      void unscheduleElement(TimelineElement element)
      Package:dji.sdk.mission
      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:
      TimelineElement elementA TimelineElement element that is already in the Timeline.
      method unscheduleElementAtIndex
      void unscheduleElementAtIndex(int index)
      Package:dji.sdk.mission
      Description:

      Removes the Element at an index in the Timeline.

      Input Parameters:
      int indexIndex of element to remove.
      method scheduledElementAtIndex
      @Nullable
      TimelineElement scheduledElementAtIndex(int index)
      Package:dji.sdk.mission
      Description:

      Returns the element at a given index in the Timeline.

      Input Parameters:
      int indexAn element index in the Timeline.
      Return:
      TimelineElementEither a mission, an element or null if nothing was at the given index.
      method scheduledCount
      int scheduledCount()
      Package:dji.sdk.mission
      Description:

      Returns the number of elements within the Timeline.

      Return:
      intElement count.
      method unscheduleEverything
      void unscheduleEverything()
      Package:dji.sdk.mission
      Description:

      Clears the Timeline, removing all elements.

      Schedule Trigger
      method
      method setTriggers
      @Override
      void setTriggers(List<Trigger> triggers)
      Package:dji.sdk.mission
      Description:

      Set the triggers for the Timeline.

      Input Parameters:
      List<Trigger> triggersList of Trigger objects.
      method getTriggers
      @Override
      List<Trigger> getTriggers()
      Package:dji.sdk.mission
      Description:

      Returns the list of triggers which are dependents of the Timeline.

      Return:
      List<Trigger>Trigger list.
      Control
      method
      method startTimeline
      void startTimeline()
      Package:dji.sdk.mission
      Description:

      Start Timeline execution from the current element index getCurrentTimelineMarker.

      method pauseTimeline
      void pauseTimeline()
      Package:dji.sdk.mission
      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()
      Package:dji.sdk.mission
      Description:

      Resume element and Timeline execution.

      method stopTimeline
      void stopTimeline()
      Package:dji.sdk.mission
      Description:

      Stops the execution of the Timeline, resets the marker index to 0. Release thread resources of timeline.

      method isTimelineRunning
      boolean isTimelineRunning()
      Package:dji.sdk.mission
      Description:

      true if the Timeline is running.

      Return:
      booleanA boolean value that is true if Timeline is running.
      method getCurrentTimelineMarker
      int getCurrentTimelineMarker()
      Package:dji.sdk.mission
      Description:

      Tells the index in the timeline array that marks where the timeline is currently at. Changing this value will reposition where the timeline will resume/start work.

      Return:
      intTimeline element index.
      method setCurrentTimelineMarker
      void setCurrentTimelineMarker(int currentTimelineMaker)
      Package:dji.sdk.mission
      Description:

      Sets the element index within the Timeline to start execution. This value can be set only when a Timeline is stopped (not executing or paused).

      Input Parameters:
      int currentTimelineMakerTimeline element index.
      method isTimelinePaused
      boolean isTimelinePaused()
      Package:dji.sdk.mission
      Description:

      true if Timeline is paused.

      Return:
      booleantrue if Timeline is paused.
      method getRunningElement
      @Nullable
      TimelineElement getRunningElement()
      Package:dji.sdk.mission
      Description:

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

      Return:
      TimelineElementTimeline element
      Listener
      method
      method addListener
      void addListener(Listener listener)
      Package:dji.sdk.mission
      Description:

      Adds a listener to all Timeline events.

      Input Parameters:
      Listener listenerA listener object.
      method removeListener
      void removeListener(Listener listener)
      Package:dji.sdk.mission
      Description:

      Removes the listener from the Timeline events listeners pool.

      Input Parameters:
      Listener listenerA previously added listener object.
      method removeAllListeners
      void removeAllListeners()
      Package:dji.sdk.mission
      Description:

      Removes all listeners from the Timeline events listeners pool.


      interface
      interface Triggerable
      interface Triggerable
      Package:dji.sdk.mission
      Description:

      Interface for object which support triggers.

      Interface Methods:
      method getTriggers
      List<Trigger> getTriggers()
      Package:dji.sdk.mission
      Description:

      Get List of Trigger objects.

      Return:
      List<Trigger>A list of Trigger objects.
      method setTriggers
      void setTriggers(List<Trigger> triggers)
      Package:dji.sdk.mission
      Description:

      Set the Trigger objects list.

      Input Parameters:
      List<Trigger> triggersList of Trigger objects to set.
      Timeline Element
      class
      Timeline Event
      interface
      interface Listener
      interface Listener
      Package:dji.sdk.mission
      Description:

      Listener used to process Timeline events.

      Interface Methods:

      Callback Method

      On Event
      method
      method onEvent
      void onEvent(@Nullable TimelineElement element, TimelineEvent event, @Nullable DJIError error)
      Package:dji.sdk.mission
      Description:

      Listener used to process Timeline events.

      Input Parameters:
      @Nullable TimelineElement elementThe Timeline element associated with the event, or null if the event is global to the whole Timeline (e.g. start, finish the Timeline).
      TimelineEvent eventEvent.
      @Nullable DJIError errorThe optional error if the event was error-related.
      enum TimelineEvent
      enum TimelineEvent
      Package:dji.sdk.mission.timeline
      Description:

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

      Enum Members:
      UNKNOWNUnknown event type. This is a default value if no other event is matching.
      STARTEDTimeline successfully started.
      START_ERRORTimeline failed to start.
      PROGRESSEDTimeline element progressed.
      PAUSEDTimeline successfully paused.
      PAUSE_ERRORTimeline failed to be paused.
      RESUMEDTimeline successfully resumed.
      RESUME_ERRORTimeline failed to resume.
      STOPPEDTimeline Stopped successfully.
      STOP_ERRORTimeline failed to stop and is still continuing in its previous state.
      FINISHEDTimeline completed its execution normally.
      Class Members:
      interface TimelineElementFeedback
      interface TimelineElementFeedback
      Package:dji.sdk.mission.timeline
      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.

      Interface Methods:

      Callback Method

      State
      method
      method onStart
      @Override
      void onStart(TimelineElement element)
      Package:dji.sdk.mission
      Description:

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

      Input Parameters:
      TimelineElement elementA previously scheduled element. Should also be the element running.
      method onStartWithError
      @Override
      void onStartWithError(TimelineElement element, DJIError error)
      Package:dji.sdk.mission
      Description:

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

      Input Parameters:
      TimelineElement elementA previously scheduled element. Should also be the element running.
      DJIError errorA valid error object.
      method onProgressWithError
      @Override
      void onProgressWithError(TimelineElement element, @Nullable DJIError error)
      Package:dji.sdk.mission
      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:
      TimelineElement elementA previously scheduled element. Should also be the element running.
      @Nullable DJIError errorAn optional error if something went wrong.
      method
      method onPause
      @Override
      void onPause(TimelineElement element)
      Package:dji.sdk.mission
      Description:

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

      Input Parameters:
      TimelineElement elementA previously scheduled element. Should also be the element running.
      method onPauseWithError
      @Override
      void onPauseWithError(TimelineElement element, DJIError error)
      Package:dji.sdk.mission
      Description:

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

      Input Parameters:
      TimelineElement elementA previously scheduled element. Should also be the element running.
      DJIError errorA valid error object.
      method
      method onResume
      @Override
      void onResume(TimelineElement element)
      Package:dji.sdk.mission
      Description:

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

      Input Parameters:
      TimelineElement elementA previously scheduled element. Should also be the element running.
      method onResumeWithError
      @Override
      void onResumeWithError(TimelineElement element, DJIError error)
      Package:dji.sdk.mission
      Description:

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

      Input Parameters:
      TimelineElement elementA previously scheduled element. Should also be the element running.
      DJIError errorA valid error object.
      method onFinishWithError
      @Override
      void onFinishWithError(TimelineElement element, DJIError error)
      Package:dji.sdk.mission
      Description:

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

      Input Parameters:
      TimelineElement elementA previously scheduled element. Should also be the element running.
      DJIError errorAn optional error if the execution end was the result of it.
      method onStopWithError
      @Override
      void onStopWithError(TimelineElement element, DJIError error)
      Package:dji.sdk.mission
      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:
      TimelineElement elementA previously scheduled element. Should also be the element running.
      DJIError errorA valid error object.