Skip to content

feature: fix busy-wait of requestShootPhoto#31

Open
TimonSchreiber wants to merge 1 commit intoWenuLink:developfrom
TimonSchreiber:feature/request-busy-wait
Open

feature: fix busy-wait of requestShootPhoto#31
TimonSchreiber wants to merge 1 commit intoWenuLink:developfrom
TimonSchreiber:feature/request-busy-wait

Conversation

@TimonSchreiber
Copy link
Copy Markdown
Collaborator

Fixes #30

Addresses the busy-wait in requestShootPhoto identified during review of #27.

Changes:

  • CameraHandler stores its CoroutineScope and exposes launchCameraJob()
  • requestShootPhoto is now a suspend function with delay(100) in both wait branches
  • requestStartCapture launches requestShootPhoto via launchCameraJob instead of calling it directly

@angel-ayala
Copy link
Copy Markdown
Collaborator

Not so sure if is a viable solution. If I'm not wrong, the MAVLink protocol requires to send CAMERA_IMAGE_CAPTURED every time that take a photo. Right now, the implemented logic is suitable for a single photo case, but definitively is not suitable for multiple photo. I think that the most appropriate solution for this is to use the SDK's ShootPhotoAction since it allows both and possible can be reactive by using the listeners pattern avoiding while loops workload. I'm unsure if it could the definitive solution since is a MissionAction and I don't know if that is a common feature among the SDK compatible Aircrafts.

@angel-ayala
Copy link
Copy Markdown
Collaborator

angel-ayala commented Mar 26, 2026

I was looking up at the SDK documentation and a proper mode must be set according to ShootPhotoMode. Additionally, there is a SystemState that can be poll in the monitor loop to sync current camera state, possibly to trigger the required MAVLink message.

EDIT

I just found the FlatCameraMode that can help to easily set camera modes. Additionally, the PHOTO_INTERVAL mode states that:

Sets the camera to take a picture (or multiple pictures) continuously at a set time interval. The minimum interval for JPEG format of any quality is 2s.

So even delay(100) patch suggested, can be easily increased to 1000.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CameraController: requestShootPhoto busy-waits between shots

2 participants