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

shipped program asynchronous_grab.py hangs #147

Closed bsdis closed 1 year ago

bsdis commented 1 year ago

I have an intel NUC and 3x ALVIUM 1800 U-2050m cameras connected to it. lsusb shows

Bus 004 Device 004: ID 1ab2:0001 Allied Vision Vision device
Bus 004 Device 003: ID 1ab2:0001 Allied Vision Vision device
Bus 004 Device 002: ID 1ab2:0001 Allied Vision Vision device
Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 003 Device 003: ID 05e3:0610 Genesys Logic, Inc. Hub
Bus 003 Device 007: ID 1a40:0801 Terminus Technology Inc. USB 2.0 Hub
Bus 003 Device 006: ID 2109:2817 VIA Labs, Inc. USB2.0 Hub             
Bus 003 Device 004: ID 2109:0102 VIA Labs, Inc. USB 2.0 BILLBOARD             
Bus 003 Device 002: ID 1a40:0801 Terminus Technology Inc. USB 2.0 Hub
Bus 003 Device 005: ID 8087:0026 Intel Corp. AX201 Bluetooth
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 003: ID 0bda:8153 Realtek Semiconductor Corp. RTL8153 Gigabit Ethernet Adapter
Bus 002 Device 002: ID 2109:0817 VIA Labs, Inc. USB3.0 Hub             
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

For some reason when i run asynchronous_grab.py in the examples directory under VimbaPython for a specific camera, only 1 frame is captured and then the script hangs and nothing more happens. What am I doing wrong here? Why is asyncgrab script not working? (I did not alter it in any way)

For the record, the synchronous_grab.py seems to be working okay and also the USB cache size is set to 2000MB.

arunprakash-avt commented 1 year ago

The asynchronous_grab.py example code is only for one camera. For multi camera example , I request you to run the Multithreading example. To run asynchronous_grab.py for individual camera, I request to increase the USB Buffer size to higher value.

Increasing the USBFS buffer size By default, the USBFS buffer size is 16 MB. This value is too low for image sizes > 2 MB or high frame rates. Check the USBFS buffer size: cat /sys/module/usbcore/parameters/usbfs_memory_mb Increase the USBFS buffer size until the next reboot (here: example value 1000): sudo sh -c 'echo 1000 > /sys/module/usbcore/parameters/usbfs_memory_mb'.

bsdis commented 1 year ago

@arunprakash-avt Yes - i am fully aware this code is only for one camera. I am however also only testing one camera. I guess that should be possible even though the other cameras are connected to the usb port? Like I said - i have not changed that example in any way. Regarding the usb buffer size, as i mentioned its already set to 2000, so that should also be more than enough. Are there other things that may cause behaviour such as the observed one?

arunprakash-avt commented 1 year ago

Can you please try to reduce the DeviceLinkThroughputLimit value to less tha Default 200 MByte/s.

arunprakash-avt commented 1 year ago

For further support, I would request you to write an email to support@alliedvision.com.

bsdis commented 1 year ago

@arunprakash-avt Hmm that did not make a difference. This is what i see when i run it:

(camtests1) pelletadmin@pelletfloat001:~/vimba/Vimba_6_0/VimbaPython/Examples$ python asynchronous_grab2.py DEV_1AB22C02134C
///////////////////////////////////////////
/// Vimba API Asynchronous Grab Example ///
///////////////////////////////////////////

Press <enter> to stop Frame acquisition.
Camera(id=DEV_1AB22C02134C) acquired Frame(id=0, status=FrameStatus.Complete, buffer=0x7f4cff645010)

Here is how i set it:

def main():
    print_preamble()
    cam_id, allocation_mode = parse_args()

    with Vimba.get_instance() as vimba:
        vimba.enable_log(LOG_CONFIG_WARNING_CONSOLE_ONLY)
        with get_camera(cam_id) as cam:

            setup_camera(cam)
            cam.DeviceLinkThroughputLimit.set(150000000)
            print('Press <enter> to stop Frame acquisition.')
bsdis commented 1 year ago

I found the issue... The reason was that AcquisitionMode had been set to SingleFrame from a previous test

arunprakash-avt commented 1 year ago

Thank you for the feedback. We would like to close this issue.