basler / pypylon

The official python wrapper for the pylon Camera Software Suite
http://www.baslerweb.com
BSD 3-Clause "New" or "Revised" License
540 stars 209 forks source link

Internal buffer overflow error using acA1920-155um on Raspberry #726

Closed vladimir-metralight closed 4 months ago

vladimir-metralight commented 4 months ago

Describe what you want to implement and what the issue & the steps to reproduce it are:

Hello,

I am working with acA1920-155um. The camera is connected to Raspberry Pi 4 Model B. I need to read single image during running of my application. The camera script was working for some time, but I am suddenly unable to read images.

I attached the zip with my python code basler.zip The code is working and I am able to read images from the camera, when I am not setting ExposureTime using line 139. BUT if I uncomment this line, the output of script says:

Model: acA1920-155um, serialNumber: 22782089
Camera instance created: <Swig Object of type 'Pylon::IPylonDevice *' at 0xe5024308>
Camera Open
MaxNumBuffer: 10
MaxNumGrabResults: 4294967295
Setting...
MaxNumBuffer: 50
Setting config node=Width to value=1920
Setting config node=Height to value=1080
Setting config node=CenterX to value=True
Setting config node=CenterY to value=True
Setting config node=AcquisitionFrameRateEnable to value=True
Setting config node=AcquisitionFrameRate to value=10
Setting config node=ExposureTime to value=65000
GetImages num=100
Grab result not succeeded. ErrorDescription:Internal buffer overflow.. ErrorCode: 3791650834
Traceback (most recent call last):
  File "/home/pi/rieter-q30-manufacturing-tools/shared/basler.py", line 144, in <module>
    imgs = cam.GetImages(100)
  File "/home/pi/rieter-q30-manufacturing-tools/shared/basler.py", line 86, in GetImages
    grabResult = self.camera.RetrieveResult(5000, pylon.TimeoutHandling_ThrowException)
  File "/home/pi/.local/lib/python3.9/site-packages/pypylon/pylon.py", line 3685, in RetrieveResult
    return _pylon.InstantCamera_RetrieveResult(self, *args)
_genicam.GenericException: QueueBuffer() failed: Device has been removed from the PC. : RuntimeException thrown (file 'PylonUsbStream.cpp', line 371)
Camera destruct
Camera Close

Sometimes the error code is:

Grab result not succeeded. ErrorDescription:Device has been removed from the PC.. ErrorCode: 3791650831

The same script is working on my windows machine even with ExposureTime set (was previously working on RPi too).

What can be the reason for this error?

Is your camera operational in Basler pylon viewer on your platform

No

Hardware setup & camera model(s) used

Camera model: acA1920-155um PC: Raspberry PI Model 4 B Camera connected directly to USB 3 port on RPi Cable length: 1.5m

Runtime information:

python: 3.9.2 (default, Mar 12 2021, 04:06:34)
platform: linux/aarch64/6.1.21-v8+
pypylon: 3.0.1 / 6.2.0.18677
vladimir-metralight commented 4 months ago

For now it looks like it was caused by undervoltage on Raspberry which got throttled and propably was not able to handle the camera properly. Which is also reason, why it behaved so strange - sometimes it worked, sometimes not. I can't tell, why it looked that it was somehow related to exposition...maybe higher consumption? Anyway: closing now as it looks resolved.