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:
/** Reference on CameraExposureValues instrument. */
private var photoProgressIndicatorRef: Ref<PhotoProgressIndicator>? = null
/** Monitors and prints photo capture progress. */
fun monitorPhotoProgress(drone: Drone) {
photoProgressIndicatorRef = drone.getInstrument(PhotoProgressIndicator::class.java) { pbotoProgress ->
// called on main thread when the instrument changes
pbotoProgress?.run {
remainingDistance
.takeIf { it.isAvailable }
?.run {
println("Remaining distance before next photo: $value meters")
}
remainingTime
.takeIf { it.isAvailable }
?.run {
println("Remaining time before next photo: $value 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:
/** Reference on MainCamera peripheral. */
private var cameraRef: Ref<MainCamera>? = null
/** `MainCamera` peripheral. This is used to know when peripheral appears. */
private var mainCamera: Camera? = null
/** Monitors and prints photo capture state. */
fun monitorPhotoProgress(drone: Drone) {
cameraRef = drone.getPeripheral(MainCamera::class.java) { camera ->
// called on main thread when the camera peripheral changes
camera?.run {
// register sub-component listener, only when camera peripheral appears
if (mainCamera == null) {
// get notified every time photo progress indicator sub-component changes
camera.component<Camera.PhotoProgressIndicator> { photoProgress ->
photoProgress?.remainingDistance.run {
println("Remaining distance before next photo: $this meters")
}
photoProgress?.remainingDistance.run {
println("Remaining time before next photo: $this seconds")
}
}
}
}
mainCamera = camera
}
}
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