mavlink
                                
                                
                                
                                    mavlink copied to clipboard
                            
                            
                            
                        Mavlink Camera: Pl clarify Timelapsed Image Capture
The camera microservice documentation is pretty clear on how image capturing works for missions, but is confusing/illogical for interactive user-initiated image capture through a GUI. The issue is gaining relevance by the fact that QGC's implementation doesn't appear to follow any "rule", as I've learned from recently digging somewhat into QGC's code and working with it.
- Issue with docs
 
The image capture sequence for interactive user-initiated image capture through a GUI is illustarted by a scheme, there the capturing is triggered by a MAV_CMD_IMAGE_START_CAPTURE (interval, count/forever), which obviously through interval/count/forever allows timelapsed capturing, but then only exactly one picture should be taken: https://mavlink.io/en/services/camera.html#camera-capture-status. This is strange in two aspects: It makes sense only if only a single-shot is triggered with MAV_CMD_IMAGE_START_CAPTURE, and 2ndly it doesn't describe a procedure of how to take timelapsed pictures.
- Issue with QGC
 
The docs seem to be clear that after each taken photo the camera should emit a CAMERA_IMAGE_CAPTURED. QGC however doesn't even accept and process this message, but only processes CAMERA_CAPTURE_STATUS messages, which however is not requested in timelapsed mode, only in video and single-shot photo. Yet it counts up the taken photos, which is obvously based only on its internal timer, and not by feedback from the camera, and which hence will necessarily run out of sync with the camera with time. And since it doesn't get CAMERA_CAPTURE_STATUS messages it also does not update the storage device information (available free memory on card) during the timelapse.
EDIT: I got the part I striked out wrong. QGC digests CAMERA_IMAGE_CAPTURED in the vehicle class, not the camera manager. The basic problem remains however that there is  no update of e.g. teh SD card since no CAMERA_CAPTURE_STATUS are requested when in timelapse mode.
Thus:
As regards GUI initiated timelapsed image capturing, there is unclearness as regards
- 
if timelapsed capturing should be done based on single-shot by the GUI or by the interval mechanism available through MAV_CMD_IMAGE_START_CAPTURE,
 - 
and what data/messages the camera should report back or should be requested by the GUI.
 
Several approaches come to mind:
- 
The GUI repeatedly triggers single-shot photos based on it's internal timer, the camera reports back a CAMERA_IMAGE_CAPTURED based on which the GUI increases its photo counter, and the GUI requests a CAMERA_CAPTURE_STATUS after each shot to update e.g. the available memory
 - 
The GUI triggers timelapsed capturing using MAV_CMD_IMAGE_START_CAPTURE with respective interval/count values, the camera reports back a CAMERA_IMAGE_CAPTURED, and the GUI repeatedly requests CAMERA_CAPTURE_STATUS based on some timing rational of its own brew
 - 
The GUI triggers timelapsed capturing using MAV_CMD_IMAGE_START_CAPTURE with respective interval,count values, and the camera reports back BOTH a CAMERA_IMAGE_CAPTURED and a CAMERA_CAPTURE_STATUS after each shot
 
Ideas?
@dogmaphobic Can you please help
For the docs, the implication is that for interactive user-initiated image capture through a GUI you can only capture a single image at a time
- is that correct?
 - presumably this means timelapse is not supported?
 
This also implies that the sequence diagram for this case is slightly wrong, because it implies that you can specify a repeat/interval (and above we're saying you can't).

Anyway Gus, can't fix the docs until those above clarified. Thanks.
@dogmaphobic Ping ^^^
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
This issue has been automatically marked as stale because it has not had recent activity. Thank you for your contributions.