Arducam 16MP IMX519 - RuntimeError: Control AfMode is not advertised by libcamera

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.

I followed this guide for installation:
https://docs.arducam.com/Raspberry-Pi-Camera/Pivariety-Camera/Quick-Start-Guide/#1-libcamera-dev-and-libcamera-apps-installation


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)

@HjalteM

https://docs.arducam.com/Raspberry-Pi-Camera/Native-camera/Quick-Start-Guide/

wget -O install_pivariety_pkgs.sh https://github.com/ArduCAM/Arducam-Pivariety-V4L2-Driver/releases/download/install_script/install_pivariety_pkgs.sh
chmod +x install_pivariety_pkgs.sh
./install_pivariety_pkgs.sh -p imx519_kernel_driver_low_speed

Have you installed the motor driver corresponding to imx519? It is installed through the corresponding installation script.

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

1 Like

@HjalteM

Before, I need some information

Please reboot your device and execute the following command:

wget -O arducam-camera-bug-report https://github.com/ketai-dhr/arducam-camera-bug-report/releases/download/tools/arducam-camera-bug-report
chmod +x ./arducam-camera-bug-report
./arducam-camera-bug-report

This will output an arducam-bug-report.txt in the current directory.

Please send this file to me via google cloud disk or similar platform or email ([email protected])…

Thank you for your cooperation and have a nice life.