alliedvision / VimbaPython

Old Allied Vision Vimba Python API. The successor to this API is VmbPy
BSD 2-Clause "Simplified" License
93 stars 40 forks source link

Loosing connection with camera, cannot reconnect #131

Closed bth5 closed 1 year ago

bth5 commented 1 year ago

Hi,

I have written a "frame grabber" that is grabbing frames from a mako gige camera. I'm having some stability issues, where sometimes i will get an error:

VmbError.Resources: -14

The camera is connected to the linux computer via a switch, and the frame grabber is run as a docker container.

As i understand it is maybe an issue with the computer hardware, which i would be able to fix in the future.

The bigger problem is, that i cannot rediscover the camera from the device afther the error. When the error occurs i raise a ConnectionError:

try:
        frame = cam.get_frame(allocation_mode = AllocationMode.AllocAndAnnounceFrame)
    except(VimbaTimeout, VimbaFeatureError) as err:
        print("CAMERA | Vimba error: {}".format(err), flush=True)
        raise ConnectionError
    else:
        frame_time = time.time()
        print("CAMERA | Got frame, took: {}s".format(frame_time-start_time), flush=True)

and tries to connect again with:

 with Vimba.get_instance() as vimba:
                cam = vimba.get_camera_by_id(id)
                with cam as cam:

But this is not working. Running list_cameras.py also returns nothing. The only way to get it running again is disconnect/reconnect the camera.

On my laptop (also connected to the switch) i can se and access the camera via. the vimba viewer and also via list_cameras.py

bth5 commented 1 year ago

I have tried with: Vimba.get_instance().set_network_discovery(True) And also to adjust GeV packet size, but no change.

Teresa-AlliedVision commented 1 year ago

Hello, the error -14 means "Resources not available (e.g. memory)". You can try adding more frames to the queue when you start the acquisition and check that the frame is always queued after it is handled in the program (i.e. that the command for that is included and can't be skipped due to if statements). Edit: Reading it through again, it does sound like a Hardware Issue. The camera should be at least still visible, even if the program is not closed crrectly or the camera is still streaming. Maybe it could also be an issue with the firewall (i.e. that it is blocking the packets/discovery). Can you disable it for that Ethernet Port? Cheers, Teresa