DJI Mobile SDK Documentation

      class ActiveTrackOperator

      class ActiveTrackOperator
      Package:dji.sdk.mission.activetrack
      Description:

      The active track mission operator is the only object that controls, runs and monitors ActiveTrack Missions. It can be accessed from MissionControl.

      An ActiveTrack Mission allows an aircraft to track a moving subject using the vision system and without a GPS tracker on the subject. To use an ActiveTrack mission:

      • Prepare a mission with the rectangle that best represents the target to track
      • Start the mission to initiate tracking of the object and begin the state updates (DJIMissionProgressStatus)
      • At this point, the aircraft will track the target while hovering in place.
      • Give confirmation that the tracked target is correct with acceptConfirmation and the aircraft will begin flying relative to the target.
      • If the tracking algorithm looses sufficient confidence in tracking the target, then the aircraft will stop flying relative to the object and either notify the user (through execution state) that the target is lost or it needs another confirmation that the target is correct.
      • If the mission is paused, the aircraft will hover in place, but continue tracking the target by adjusting gimbal pitch and aircraft yaw.
      • If mission is resumed, confirmation of tracking rectangle will need to be sent through to start flying relative to target.
      • The mission can be canceled with stopTracking at any time.
      • stopTracking should also be used to reject tracking confirmation if the camera is tracking the wrong target. After stopping the mission, the mission needs to be recreated with a new rectangle and loaded into the operator.
      • The main camera is used to track the target, so gimbal cannot be adjusted during an ActiveTrack mission.
      • During the mission the aircraft can be manually flown with pitch, roll and throttle. Yaw and gimbal are automatically controlled to continue tracking the target.
      • If the mission is executing, and after confirmation of the tracking rectangle has been sent, the aircraft can be manually controlled horizontally similar to a HOME_LOCK where the home is the tracked target. If aircraft is manually controlled upward, the aircraft will lift and retreat, and if it is controlled downward, it will go down and get closer to the target.

      Class Members:
      Current State
      method
      method getCurrentState
      @NonNull
      ActiveTrackState getCurrentState()
      Package:dji.sdk.mission.activetrack
      Description:

      The current state of the operator.

      Return:
      ActiveTrackStateAn object of ActiveTrackState.
      Check Gesture Mode Enabled
      method
      method isGestureModeEnabled
      boolean isGestureModeEnabled()
      Package:dji.sdk.mission.activetrack
      Description:

      true if gesture mode is enabled. Value is undefined if the getCurrentState is one of the following:

      Return:
      booleantrue if the product supports gesture mode.
      Check Auto Sensing Enabled
      method
      method isAutoSensingEnabled
      boolean isAutoSensingEnabled()
      Package:dji.sdk.mission.activetrack
      Description:

      true if auto sensing is enabled. Value is undefined if the getCurrentState is one of the following:

      Return:
      booleantrue if auto sensing is enabled.
      method isAutoSensingForQuickShotEnabled
      boolean isAutoSensingForQuickShotEnabled()
      Package:dji.sdk.mission.activetrack
      Description:

      true if auto sensing for QuickShot is enabled. Value is undefined if the getCurrentState is one of the following:

      Return:
      booleantrue if the product supports gesture mode.
      Add Listener
      method
      method addListener
      void addListener(@NonNull ActiveTrackMissionOperatorListener listener)
      Package:dji.sdk.mission.activetrack
      Description:

      Add a listener to listen to events in the ActiveTrack operator.

      Input Parameters:
      @NonNull ActiveTrackMissionOperatorListener listenerListener that is interested in the ActiveTrack mission operator events.
      Remove Listener
      method
      method removeListener
      void removeListener(@NonNull ActiveTrackMissionOperatorListener listener)
      Package:dji.sdk.mission.activetrack
      Description:

      Removes listener. The listener will not receive any update after calling this method.

      Input Parameters:
      @NonNull ActiveTrackMissionOperatorListener listenerListener to be removed.
      method removeAllListeners
      void removeAllListeners()
      Package:dji.sdk.mission.activetrack
      Description:

      Remove all listeners.

      Set Gesture Mode Enabled
      method
      method setGestureModeEnabled
      void setGestureModeEnabled(boolean enabled, @Nullable CommonCallbacks.CompletionCallback callback)
      Package:dji.sdk.mission.activetrack
      Description:

      Enables/disables gesture mode.

      • A human subject can be automatically detected if they are moving a little (instead of requiring a defining rectangle)
      • The human subject can accept the confirmation to track them by waving their arms.
      • The tracked human can make the camera shoot a photo by showing a rectangle with their thumbs and index fingers to the aircraft.
      Gesture mode can only be enabled when the aircraft is flying but not tracking a target. The getCurrentState should be one of the following: After the gesture mode is enabled, getCurrentState will become DETECTING_HUMAN.

      Gesture mode can be disabled when getCurrentState is not any of the following: If the aircraft is already tracking a target, disabling gesture mode will stop the ActiveTrack mission.

      Input Parameters:
      boolean enabledtrue to enable gesture mode.
      @Nullable CommonCallbacks.CompletionCallback callbackThe execution callback with the returned execution result.
      Check AutoSensing Supported
      method
      method isAutoSensingSupported
      boolean isAutoSensingSupported()
      Package:dji.sdk.mission.activetrack
      Description:

      Checks if the connected product supports auto sensing. When the product supports auto sensing, enabling auto sensing is the pre-condition of starting active track.

      Return:
      booleantrue if the product supports auto sensing.
      Enable AutoSensing
      method
      method enableAutoSensing
      void enableAutoSensing(@Nullable CommonCallbacks.CompletionCallback callback)
      Package:dji.sdk.mission.activetrack
      Description:

      Starts auto sensing. After auto sensing starts, the aircraft will sense humans captured by the camera and return the detected subjects by getAutoSensedSubjects in the updated event. QuickShot requires a special auto sensing mode, therefore, use enableAutoSensingForQuickShot if a QuickShot mission will be performed. It is only supported when isAutoSensingSupported returns true. When the product supports auto sensing, enabling auto sensing is the pre-condition of starting active track.

      Input Parameters:
      @Nullable CommonCallbacks.CompletionCallback callbackThe execution callback with the returned execution result.
      method enableAutoSensingForQuickShot
      void enableAutoSensingForQuickShot(@Nullable CommonCallbacks.CompletionCallback callback)
      Package:dji.sdk.mission.activetrack
      Description:

      Starts auto sensing specifically for QuickShot. After auto sensing starts, the aircraft will sense humans captured by the camera and return the detected subjects by getAutoSensedSubjects in the updated event. This interface is specific for QuickShot, therefore, use enableAutoSensing for missions other than QuickShot. It is only supported when isAutoSensingSupported returns true. When the product supports auto sensing, enabling auto sensing is the pre-condition of starting active track.

      Input Parameters:
      @Nullable CommonCallbacks.CompletionCallback callbackThe execution callback with the returned execution result.
      Disable AutoSensing
      method
      method disableAutoSensing
      void disableAutoSensing(@Nullable CommonCallbacks.CompletionCallback callback)
      Package:dji.sdk.mission.activetrack
      Description:

      Stops auto sensing (either for QuickShot or the other active track modes). It is only supported when isAutoSensingSupported returns true.

      Input Parameters:
      @Nullable CommonCallbacks.CompletionCallback callbackThe execution callback with the returned execution result.
      Check Start Mission
      method
      method canStartTracking
      DJIError canStartTracking(@NonNull ActiveTrackMission mission)
      Package:dji.sdk.mission.activetrack
      Description:

      Checks if the operator can start the mission.

      Input Parameters:
      @NonNull ActiveTrackMission missionAn ActiveTrack mission.
      Return:
      DJIErrorThe possible error if the operator tries to start the mission.
      Start Mission
      method
      method startTracking
      void startTracking(@NonNull ActiveTrackMission mission,
      @Nullable CommonCallbacks.CompletionCallback callback)
      Package:dji.sdk.mission.activetrack
      Description:

      Starts to execute an ActiveTrack mission. It can only be called when the getCurrentState is IDLE. If a mission with TRACE or PROFILE is started successfully, the getCurrentState will become one of the following:

      If a mission with SPOTLIGHT or SPOTLIGHT_PRO is started successfully, the getCurrentState will become ONLY_CAMERA_FOLLOWING.

      Input Parameters:
      @NonNull ActiveTrackMission missionThe ActiveTrack mission to check.
      @Nullable CommonCallbacks.CompletionCallback callbackThe execution callback with the returned execution result.
      method startAutoSensingMission
      void startAutoSensingMission(@NonNull ActiveTrackMission mission,
      @Nullable CommonCallbacks.CompletionCallback callback)
      Package:dji.sdk.mission.activetrack
      Description:

      Starts to execute an ActiveTrack mission after auto sensing (either for QuickShot or the other active track modes) is started. The aircraft will start to track the subject defined by setTargetIndex. If auto sensing for active track modes other than QuickShot is enabled, the active track mode to start is defined by ActiveTrackMission's setMode. getQuickShotMode of ActiveTrackMission will be ignored. If auto sensing specifically for QuickShot is enabled, The QuickShot mode to start is defined by ActiveTrackMission's getQuickShotMode. getQuickShotMode of ActiveTrackMission will be ignored.

      It can only be called when the getCurrentState is one of the following:
      - AUTO_SENSING
      - AUTO_SENSING_FOR_QUICK_SHOT
      If the aircraft has high confidence about the auto-sensed subject, confirmation is not required and the state will change to AIRCRAFT_FOLLOWING or ONLY_CAMERA_FOLLOWING (determined by the active track mode). Otherwise, the state will change to WAITING_FOR_CONFIRMATION and user need to perform acceptConfirmation.

      Input Parameters:
      @NonNull ActiveTrackMission missionThe ActiveTrack mission to check.
      @Nullable CommonCallbacks.CompletionCallback callbackThe execution callback with the returned execution result.
      Stop Mission
      method
      method stopTracking
      void stopTracking(@Nullable CommonCallbacks.CompletionCallback callback)
      Package:dji.sdk.mission.activetrack
      Description:

      Stops the executing mission. It can only be called when the getCurrentState is one of the following:

      After a mission is stopped successfully, getCurrentState will become IDLE or DETECTING_HUMAN if gesture mode is enabled.

      Input Parameters:
      @Nullable CommonCallbacks.CompletionCallback callbackThe execution callback with the returned execution result.
      Accept Confirmation
      method
      method acceptConfirmation
      void acceptConfirmation(@Nullable CommonCallbacks.CompletionCallback callback)
      Package:dji.sdk.mission.activetrack
      Description:

      When the vision system is not sure the tracking rectangle is around the user's desired target, it will need confirmation before starting to fly relative to the target. The vision system will need confirmation when getCurrentState is IDLE. getTargetRect of ActiveTrackTrackingState can be used to show the user the rectangle the vision system is using. If the user agrees the rectangle represents the target they want to track, this method can be called to start flying relative to the target.

      Input Parameters:
      @Nullable CommonCallbacks.CompletionCallback callbackThe execution callback with the returned execution result.
      Reject Confirmation
      method
      method rejectConfirmation
      void rejectConfirmation(@Nullable CommonCallbacks.CompletionCallback callback)
      Package:dji.sdk.mission.activetrack
      Description:

      Rejects the target rectangle from the aircraft.

      Input Parameters:
      @Nullable CommonCallbacks.CompletionCallback callbackThe execution callback with the returned execution result.
      Stop Aircraft Following
      method
      method stopAircraftFollowing
      void stopAircraftFollowing(@Nullable CommonCallbacks.CompletionCallback callback)
      Package:dji.sdk.mission.activetrack
      Description:

      Stops the aircraft from following the target and ask for user confirmation again. It can only be called when the getCurrentState is AIRCRAFT_FOLLOWING. After it is called successfully, getCurrentState will become WAITING_FOR_CONFIRMATION.

      Input Parameters:
      @Nullable CommonCallbacks.CompletionCallback callbackThe execution callback with the returned execution result.
      Set Circular Speed
      method
      method setCircularSpeed
      void setCircularSpeed(float speed, @Nullable CommonCallbacks.CompletionCallback callback)
      Package:dji.sdk.mission.activetrack
      Description:

      Setting a non-zero speed starts the aircraft circling the target. Speed can be set within the range [-5, 5] m/s where a positive speed is a counter-clockwise movement (when viewing from the top). Reverting the speed to 0 m/s ends the circling movement. It can only be called when the getCurrentState is AIRCRAFT_FOLLOWING .

      Input Parameters:
      float speedCircular speed to set in m/s.
      @Nullable CommonCallbacks.CompletionCallback callbackThe execution callback with the returned execution result.
      Get Circular Speed
      method
      method getCircularSpeed
      void getCircularSpeed(@NonNull CommonCallbacks.CompletionCallbackWith<Float> callback)
      Package:dji.sdk.mission.activetrack
      Description:

      In an ActiveTrack mission, the aircraft can be set to circle the target while following it. This method returns the circular speed of the aircraft in m/s.

      Input Parameters:
      @NonNull CommonCallbacks.CompletionCallbackWith<Float> callbackThe execution callback with the returned execution result.
      Switch Mode
      method
      method switchMode
      void switchMode(@NonNull ActiveTrackMode mode, @Nullable CommonCallbacks.CompletionCallback callback)
      Package:dji.sdk.mission.activetrack
      Description:

      Changes the ActiveTrack mode on the currently executing mission. It can only be called when the getCurrentState is one of the following:

      If the current state is AIRCRAFT_FOLLOWING, stopAircraftFollowing should be called before switching the mode. Also, The ActiveTrack mode can only be changed when gesture mode is disabled.

      Input Parameters:
      @NonNull ActiveTrackMode modeActive track mode to change.
      @Nullable CommonCallbacks.CompletionCallback callbackThe execution callback with the returned execution result.
      Recommended Configuration
      method
      method setRecommendedConfiguration
      void setRecommendedConfiguration(@Nullable CommonCallbacks.CompletionCallback callback)
      Package:dji.sdk.mission.activetrack
      Description:

      Sets the recommended camera and gimbal configuration that optimizes performance for the ActiveTrack Mission in most environments.

      Input Parameters:
      @Nullable CommonCallbacks.CompletionCallback callbackThe execution callback with the returned execution result.
      Retreat Enabled
      method
      method setRetreatEnabled
      void setRetreatEnabled(boolean enabled, @Nullable CommonCallbacks.CompletionCallback callback)
      Package:dji.sdk.mission.activetrack
      Description:

      Enables/disable if the aircraft can retreat (fly backwards) when the target comes toward it. When it is disabled, the aircraft will not retreat and instead rotate the gimbal pitch down to track the target as it goes underneath. If the target goes beyond the gimbal's pitch stop, the target will be lost and the mission will stop.

      Input Parameters:
      boolean enabledtrue to enable retreat during ActiveTrack mission.
      @Nullable CommonCallbacks.CompletionCallback callbackThe execution callback with the returned execution result.
      method getRetreatEnabled
      void getRetreatEnabled(@NonNull CommonCallbacks.CompletionCallbackWith<Boolean> callback)
      Package:dji.sdk.mission.activetrack
      Description:

      Determines whether retreat is enabled in ActiveTrack mission.

      Input Parameters:
      @NonNull CommonCallbacks.CompletionCallbackWith<Boolean> callbackThe execution callback with the returned execution result.
      interface ActiveTrackMissionOperatorListener
      interface ActiveTrackMissionOperatorListener
      Package:dji.sdk.mission.activetrack
      Description:

      Listener interface used to listen to ActiveTrack mission events.

      Interface Methods:

      Callback Method

      State
      method
      method onUpdate
      void onUpdate(ActiveTrackMissionEvent event)
      Package:dji.sdk.mission.activetrack
      Description:

      Called when an event occurs in the ActiveTrack mission.

      Input Parameters:
      ActiveTrackMissionEvent eventAn object of ActiveTrackMissionEvent.