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)

1 Like

@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/i2c@1/imx519@1a 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/i2c@1/imx519@1a - 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.

@Edward
@HjalteM

I have exactly the same problem.
What was the solution?
Thanks in advance.

Regards Chris

@Chris3785

You can do the same as above. Run a script to show me the basic information.

To be frank, my solution was to switch to the raspberry pi camera 3. That wasn’t an easy decision, since it required design changes to the hardware and we would very much have prefered the larger resolution of the arducam, but the issues with the arducam was getting ridiculous. The raspberry pi camera setup was as straightforward as it should be and it has been running without issues.

@HjalteM

We are currently actively communicating with people in the upstream branch and merging these updates. In fact, we have committed most of the content to the Raspberry Pi branch. But there are still some content that have not been submitted for some reasons. Our future plan is to commit them all upstream. At that time, it will be the same as the official Raspberry Pi camera.

You can also see the latest progress from our doc
https://docs.arducam.com/Raspberry-Pi-Camera/Native-camera/Quick-Start-Guide/#software-guide-for-imx519-autofocus-camera
After 6.1.21, it is no longer necessary to install the imx519 part, but libcamera still needs to be installed. There are still some kinks that need to be addressed in the commit plan for the libcamera upstream branch, but these will definitely be addressed in the future.