Get an indication of when the camera has finished autofocus

  1. Where did you get the camera module(s)?
    Kickstarter

  2. Model number of the product(s)?
    B0371

  3. What hardware/platform were you working on?
    Raspberry Pi 4

  4. Instructions you have followed. (link/manual/etc.)
    using an example based on AutofocusControl.py

  5. Problems you were having?
    setting picam2.set_controls({"AfMode": 1 ,"AfTrigger": 0}) just once does not seem to get me a focused image.

  6. Troubleshooting attempts you’ve made?
    Placing that command in a loop with the image capture like so:

while True:
  picam2.set_controls({"AfMode": 1 ,"AfTrigger": 0})
  time.sleep(5)
  image = picam2.capture_array("main")

eventually leads to images being in focus.

  1. What help do you need?
    Is there a way to determine if focusing has finished so as to be able to only trigger a capture when that is finished?