Search code examples
dji-sdk

Programatically pause timeline mission after DJIGimbalAttitudeAction


I have created a timeline mission to run a set of actions so the drone flies in a straight line capturing photos at 2 second intervals while the camera points straight down. I want the mission to pause just after the gimbal action completes. Here are the scheduled actions:

  • DJITakeOffAction
  • DJIGoToAction (coordinate with altitude)
  • DJIGimbalAttitudeAction (pitch -90)
  • DJIShootPhotoAction (initWithPhotoCount 20, interval 2 seconds, wait NO)
  • DJIGoToAction (coordinate with altitude)

The mission runs fine but I want to pause the timeline programatically after a DJIGimbalAttitudeAction completes so I can adjust the camera settings before the last two actions are run.

Is this possible? I tried to execute this if the indexOfScheduledElement matched the index of the DJIGimbalAttitudeAction timeline element in the addListener:(id)listener toTimelineProgressWithBlock of DJIMissionControl but I got a DJISDKMissionErrorDomain error 10007

On playing around with this, pausing programmatically seems to work fine if the timeline is in the middle of something like a DJIGoToAction but anything else seems to cause an error. Is there a better way to execute pauseTimeline cleanly?


Solution

  • After a lot of testing I found that if I trigger pauseTimeline when the currently running timeline element is at the DJIMissionControlTimelineEventStarted event in the timeline listener it will pause just fine as long as the action/element running is NOT a DJIShootPhotoAction - any pause on a DJIShootPhotoAction results in a camera busy error.

    If the same actions (e.g. DJIGoToAction, DJIAircraftYawAction, DJIGimbalAttitudeAction) are at the DJIMissionControlTimelineEventProgressed stage they fails with DJISDKMissionErrorDomain error 10007

    [DJISDKManager.missionControl addListener:self toTimelineProgressWithBlock:^(DJIMissionControlTimelineEvent event, id<DJIMissionControlTimelineElement>  _Nullable element, NSError * _Nullable error, id  _Nullable info) {
        if (event == DJIMissionControlTimelineEventStarted) {
          [DJISDKManager.missionControl pauseTimeline];
        }
      }];