When trying the autofocus example below, I receive the error RuntimeError: Control AfMode is not advertised by libcamera. I can use the camera with the command line, even with e.g. autofocus-on-capture, without error - but the camera is not focusing.
I am running a headless setup with ssh to the RPi (4, 8gb). libcamera-dev 0.0.12.
import time
from picamera2 import Picamera2, Preview
picam2 = Picamera2()
#picam2.start_preview(Preview.QTGL)
preview_config = picam2.create_preview_configuration()
picam2.configure(preview_config)
picam2.start()
time.sleep(1)
# If your libcamera-dev version is lower than 0.0.10, please use the following code.
# picam2.set_controls({"AfTrigger": 0})
# If your libcamera-dev version is greater than or equal to 0.0.10, please use the following code.
# AfMode Set the AF mode (manual, auto, continuous)
picam2.set_controls({"AfMode": 1 ,"AfTrigger": 0})
time.sleep(5)
Yes. I have followed the installation guide on several blank images. I just went through the script you provided and I still recieve the same error:
[0:11:26.973240087] [1931] INFO Camera camera_manager.cpp:299 libcamera v0.0.3+40-9b860a66
[0:11:26.999585051] [1932] INFO RPI raspberrypi.cpp:1425 Registered camera /base/soc/i2c0mux/[email protected]/[email protected] to Unicam device /dev/media2 and ISP device /dev/media0
[0:11:27.004852455] [1931] INFO Camera camera.cpp:1028 configuring streams: (0) 640x480-XBGR8888
[0:11:27.005241563] [1932] INFO RPI raspberrypi.cpp:805 Sensor: /base/soc/i2c0mux/[email protected]/[email protected] - Selected sensor format: 1280x720-SRGGB10_1X10 - Selected unicam format: 1280x720-pRAA
Traceback (most recent call last):
File “/home/tecologyTrap1/tecology/camtest.py”, line 28, in
picam2.set_controls({“AfMode”: 1 ,“AfTrigger”: 0})
File “/usr/lib/python3/dist-packages/picamera2/picamera2.py”, line 1066, in set_controls
self.controls.set_controls(controls)
File “/usr/lib/python3/dist-packages/picamera2/controls.py”, line 58, in set_controls
self.setattr(k, v)
File “/usr/lib/python3/dist-packages/picamera2/controls.py”, line 33, in setattr
raise RuntimeError(f"Control {name} is not advertised by libcamera")
RuntimeError: Control AfMode is not advertised by libcamera