benstanfish / TimelapsePy

Library for simplifying and automating time lapse photography using a Raspberry Pi and camera. Can also use ffmpeg to convert images to mp4 if desired.
Creative Commons Zero v1.0 Universal
2 stars 1 forks source link

Ran into this error when trying your scripts #2

Open Deses opened 1 year ago

Deses commented 1 year ago
pi@pi3:~/timelapses/TimelapsePy $ python timelapse.py
tlogger.py <version 0.0.2> imported.
usersettings.py <version 0.0.1> imported.
tutilities.py <version 0.0.3> imported.
[2:07:28.607665408] [2178]  INFO Camera camera_manager.cpp:297 libcamera v0.0.5+83-bde9b04f
[2:07:28.648126597] [2180]  INFO RPI vc4.cpp:437 Registered camera /base/soc/i2c0mux/i2c@1/ov5647@36 to Unicam device /dev/media3 and ISP device /dev/media0
[2:07:28.648294565] [2180]  INFO RPI pipeline_base.cpp:1101 Using configuration file '/usr/share/libcamera/pipeline/rpi/vc4/rpi_apps.yaml'
[2:07:28.660302209] [2178]  INFO Camera camera.cpp:1033 configuring streams: (0) 3840x2160-BGR888 (1) 2592x1944-SGBRG10_CSI2P
[2:07:28.660905695] [2180]  INFO RPI vc4.cpp:565 Sensor: /base/soc/i2c0mux/i2c@1/ov5647@36 - Selected sensor format: 2592x1944-SGBRG10_1X10 - Selected unicam format: 2592x1944-pGAA
2023-07-30 16:16:49,218 - TimelapsePy - ERROR - Error at division
Traceback (most recent call last):
  File "/home/pi/timelapses/TimelapsePy/timelapse.py", line 35, in <module>
    picam2.set_controls({"AfMode": util.get_focal_mode(users.user_focus_mode),
  File "/usr/lib/python3/dist-packages/picamera2/picamera2.py", line 1093, 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

I'm using an old Pi Camera 1.3 that doesn't have AF or anything fancy, uses the ov5647 sensor and works well when I manually use libcamera-still.

If i comment line 35 and 36, it works.

benstanfish commented 1 year ago

I was having some issues with Lines 35 and 36 myself. I'm debating whether to remove them all together, or add code to determine if the camera has AF capability before applying controls. More to come.

Deses commented 1 year ago

You are in luck! I spent most of today tinkering around my Pi and the camera and did some changes you might like.

Kindly review it here: https://github.com/benstanfish/TimelapsePy/pull/6/ 😄