The active track mission operator is the only object that controls, runs and monitors ActiveTrack Missions. It can be accessed from DJIMissionControl.
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 (currentState)
At this point, the aircraft will track the target while hovering in place.
Give confirmation that the tracked target is correct with acceptConfirmationWithCompletion and the aircraft will begin flying relative to the target. For Mavic Air 2 and DJI Air 2S, only CIRCLE mode need to be confirmation.
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 you want to pause the mission, you can swith the mission mode to DJIActiveTrackModeSpotlight, the aircraft will hover in place, but continue tracking the target by adjusting gimbal pitch and aircraft yaw.
If you want to resume the mission, You can switch the mission mode to track mode again, confirmation of tracking rectangle will need to be sent through to start flying relative to target. (For Mavic Air 2 and DJI Air 2S, there is no need to confirm when you switch mode, Since there is no obstacle avoidance system on the left and right sides, be especially careful in the CIRCLE mode.)
stopMissionWithCompletion 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 roll and throttle. Pitch,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 DJIFlightOrientationModeHomeLock 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.
For Mavic Air 2 and DJI Air 2S, you can use the ActiveTrack Mission in the Normal, Sport, Tripod flight modes. Because obstacle sensing is disabled in sport mode, so please use ActiveTrack Mission in an open area.
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.
Starts auto sensing. After auto sensing starts, the aircraft will sense humans captured by the camera and return the detected subjects by autoSensedSubjects in the updated event. QuickShot requires a special auto sensing mode, therefore, use enableAutoSensingForQuickShotWithCompletion if a QuickShot mission will be performed. It is only supported when isAutoSensingSupported returns YES. When the product supports auto sensing, enabling auto sensing is the pre-condition of starting active track.
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 autoSensedSubjects in the updated event. This interface is specific for QuickShot, therefore, use enableAutoSensingWithCompletion for missions other than QuickShot. It is only supported when isAutoSensingSupported returns YES. When the product supports auto sensing, enabling auto sensing is the pre-condition of starting active track. Not supported by Mavic Air 2, DJI Air 2S.
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 subjectIndex. If auto sensing for active track modes other than QuickShot is enabled, the active track mode to start is defined by DJIActiveTrackMission's mode. quickShotMode of DJIActiveTrackMission will be ignored. If auto sensing specifically for QuickShot is enabled, The QuickShot mode to start is defined by DJIActiveTrackMission's quickShotMode. quickShotMode of DJIActiveTrackMission will be ignored.
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 currentState is DJIActiveTrackMissionStateReadyToStart. targetRect of DJIActiveTrackTrackingState 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. For Mavic Air 2, DJI Air 2S, there is only CIRCLE mode need to confirm.
Setting a non-zero speed starts the aircraft circling the target. Speed can be set within the range [-5, 5] m/s(For Mavic Air 2 and DJI Air 2S the value of circular speed is only a relative value, like 5 means to circle according to the maximum flight speed of the aircraft under the current radius, it's not measured in 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 currentState is DJIActiveTrackMissionStateAircraftFollowing and trackingMode is DJIActiveTrackModeTrace.
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. (For Mavic Air 2 and DJI Air 2S, the value of circular speed is only a relative value, 5 means to circle according to the maximum flight speed of the aircraft under the current radius, but it's not measured in m/s.)
Input Parameters:
DJIFloatCompletionBlock completion
Completion block that will be called when the operation succeeds or fails. If it fails, an error will be returned.
If the current state is DJIActiveTrackMissionStateAircraftFollowing, stopAircraftFollowingWithCompletion should be called before switching the mode. Also, The ActiveTrack mode can only be changed when gesture mode is disabled. For Mavic Air 2 and DJI Air 2S, there are no these two restrictions. Mavic 2 Series does not support this interface, you should stop the mission and start a new mission to replace this function.
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. Not supported by Mavic Air 2, DJI Air 2S.