Photo progress indicator#

The photo progess indicator provides information on photo capture progress. For photo capture modes gpsLapse and timeLapse, it indicates remaining distance or time before next photo capture.

Camera 1#

The photo progress indicator is the instrument Instruments.photoProgressIndicator.

Sample code to monitor photo progress indicator:

/// Keep reference on PhotoProgressIndicator instrument to get notified of changes.
private var photoProgressIndicatorRef: Ref<PhotoProgressIndicator>?

/// Monitors and prints photo capture progress.
func monitorPhotoProgress(drone: Drone) {
    photoProgressIndicatorRef = drone.getInstrument(Instruments.photoProgressIndicator) { indicator in
        if let remainingDistance = indicator?.remainingDistance {
            print("Remaining distance before next photo: \(remainingDistance) meters")
        }
        if let remainingTime = indicator?.remainingTime {
            print("Remaining time before next photo: \(remainingTime) seconds")
        }
    }
}

Example of output:

Remaining time before next photo: 1.499854326248169 seconds
Remaining time before next photo: 0.9997818470001221 seconds
Remaining time before next photo: 0.4998341202735901 seconds
Remaining time before next photo: 1.9997859001159668 seconds
Remaining time before next photo: 1.5000852346420288 seconds
Remaining time before next photo: 1.0000818967819214 seconds
Remaining time before next photo: 0.5000885128974915 seconds

Camera 2#

Photo capture state is monitored with sub-component Camera2Components.photoProgressIndicator.

Sample code to monitor photo progress indicator:

/// Keep reference on Camera2PhotoProgressIndicator component to get notified of changes.
private var photoProgressIndicatorRef: Ref<Camera2PhotoProgressIndicator>?

/// Monitors and prints photo capture state.
func monitorPhotoProgress(drone: Drone) {
    if let camera = drone.getPeripheral(Peripherals.mainCamera2) {
        // get photoProgressIndicator component reference and register listener
        photoProgressIndicatorRef = camera.getComponent(Camera2Components.photoProgressIndicator) { indicator in
            if let remainingDistance = indicator?.remainingDistance {
                print("Remaining distance before next photo: \(remainingDistance) meters")
            }
            if let remainingTime = indicator?.remainingTime {
                print("Remaining time before next photo: \(remainingTime) seconds")
            }
        }
    }
}

Example of output:

Remaining time before next photo: 1.5738348960876465 seconds
Remaining time before next photo: 1.5738348960876465 seconds
Remaining time before next photo: 1.0738394260406494 seconds
Remaining time before next photo: 1.0738394260406494 seconds
Remaining time before next photo: 0.5738322734832764 seconds
Remaining time before next photo: 0.5738322734832764 seconds
Remaining time before next photo: 0.07383007556200027 seconds
Remaining time before next photo: 0.07383007556200027 seconds
Remaining time before next photo: 1.7220635414123535 seconds
Remaining time before next photo: 1.7220635414123535 seconds