alliedvision / VmbPy

Python API of the Vimba X SDK
BSD 2-Clause "Simplified" License
23 stars 8 forks source link

Can't connect more than 2 cameras #9

Open chasef925 opened 1 year ago

chasef925 commented 1 year ago

I have a fairly rudimentary prototype code where I'm attempting to use 4 alvium USB3 cameras. I was able to use 4 cameras using Vimba 6.2. Updating to VmbPy, I can use two cameras just fine, but I get an error when I attempt to acquire images with more than two. This includes running the multithread example. When I run my code, the error trace looks like this:

Traceback (most recent call last): File "/home/opluser/.local/lib/python3.8/site-packages/vmbpy/stream.py", line 125, in enter call_vmb_c('VmbCaptureStart', self.context.stream_handle) File "/home/opluser/.local/lib/python3.8/site-packages/vmbpy/util/tracer.py", line 131, in wrapper result = func(*args, *kwargs) File "/home/opluser/.local/lib/python3.8/site-packages/vmbpy/c_binding/vmb_c.py", line 891, in call_vmb_c getattr(_lib_instance, func_name)(args) File "/home/opluser/.local/lib/python3.8/site-packages/vmbpy/c_binding/vmb_c.py", line 815, in _eval_vmberror raise VmbCError(result) vmbpy.c_binding.vmb_common.VmbCError: VmbCError(<VmbError.GenTLUnspecified: -22>)

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "/home/opluser/.local/lib/python3.8/site-packages/vmbpy/stream.py", line 502, in start_streaming self.__capture_fsm.enter_capturing_mode() File "/home/opluser/.local/lib/python3.8/site-packages/vmbpy/stream.py", line 258, in enter_capturing_mode self.go_to_state(_CaptureFsm.STATE_ORDER[-1]) File "/home/opluser/.local/lib/python3.8/site-packages/vmbpy/stream.py", line 233, in go_to_state self.__states[-1].enter() # type: ignore File "/home/opluser/.local/lib/python3.8/site-packages/vmbpy/util/tracer.py", line 131, in wrapper result = func(*args, **kwargs) File "/home/opluser/.local/lib/python3.8/site-packages/vmbpy/stream.py", line 127, in enter raise _build_camera_error(self.context.cam, self.context.stream, e) from e vmbpy.error.VmbCameraError: <VmbError.GenTLUnspecified: -22>

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/home/opluser/.local/lib/python3.8/site-packages/vmbpy/stream.py", line 132, in exit call_vmb_c('VmbCaptureEnd', self.context.stream_handle) File "/home/opluser/.local/lib/python3.8/site-packages/vmbpy/util/tracer.py", line 131, in wrapper result = func(*args, *kwargs) File "/home/opluser/.local/lib/python3.8/site-packages/vmbpy/c_binding/vmb_c.py", line 891, in call_vmb_c getattr(_lib_instance, func_name)(args) File "/home/opluser/.local/lib/python3.8/site-packages/vmbpy/c_binding/vmb_c.py", line 815, in _eval_vmberror raise VmbCError(result) vmbpy.c_binding.vmb_common.VmbCError: VmbCError(<VmbError.Already: -33>)

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "1 cam.py", line 97, in cam3.start_streaming(handler = frame_callback_3, buffer_count=7, allocation_mode = vmbpy.AllocationMode.AnnounceFrame) File "/home/opluser/.local/lib/python3.8/site-packages/vmbpy/util/tracer.py", line 131, in wrapper result = func(*args, kwargs) File "/home/opluser/.local/lib/python3.8/site-packages/vmbpy/util/context_decorator.py", line 101, in wrapper return func(*args, *kwargs) File "/home/opluser/.local/lib/python3.8/site-packages/vmbpy/util/runtime_type_check.py", line 58, in wrapper return func(args, kwargs) File "/home/opluser/.local/lib/python3.8/site-packages/vmbpy/camera.py", line 351, in start_streaming self.streams[0].start_streaming(handler=handler, File "/home/opluser/.local/lib/python3.8/site-packages/vmbpy/util/tracer.py", line 131, in wrapper result = func(*args, kwargs) File "/home/opluser/.local/lib/python3.8/site-packages/vmbpy/util/context_decorator.py", line 101, in wrapper return func(*args, *kwargs) File "/home/opluser/.local/lib/python3.8/site-packages/vmbpy/util/runtime_type_check.py", line 58, in wrapper return func(args, kwargs) File "/home/opluser/.local/lib/python3.8/site-packages/vmbpy/stream.py", line 504, in start_streaming self.__capture_fsm.leave_capturing_mode() File "/home/opluser/.local/lib/python3.8/site-packages/vmbpy/stream.py", line 262, in leave_capturing_mode self.go_to_state(None) File "/home/opluser/.local/lib/python3.8/site-packages/vmbpy/stream.py", line 236, in go_to_state self.states.pop().exit() # type: ignore File "/home/opluser/.local/lib/python3.8/site-packages/vmbpy/util/tracer.py", line 131, in wrapper result = func(*args, **kwargs) File "/home/opluser/.local/lib/python3.8/site-packages/vmbpy/stream.py", line 134, in exit raise _build_camera_error(self.context.cam, self.context.stream, e) from e vmbpy.error.VmbCameraError: <VmbError.Already: -33>

When I run the multithread example, the output is

2023-07-17 14:55:56,910 | Thread 'MainThread' started. 2023-07-17 14:55:56,910 | Starting vmbpy: 1.0.2 (using VmbC: 1.0.2, VmbImageTransform: 2.0) 2023-07-17 14:55:57,280 | Thread 'FrameProducer(DEV_1AB22C0181B3)' started. 2023-07-17 14:55:57,281 | Thread 'FrameProducer(DEV_1AB22C01DF37)' started. 2023-07-17 14:55:57,283 | Thread 'FrameProducer(DEV_1AB22C01DF39)' started. 2023-07-17 14:55:57,284 | Thread 'FrameConsumer' started. 2023-07-17 14:55:57,584 | <VmbError.GenTLUnspecified: -22> 2023-07-17 14:55:57,585 | Thread 'FrameProducer(DEV_1AB22C01DF37)' terminated.

If I change which cameras are plugged in, there's always a different camera that gets chosen as the odd one out.

I'm currently running Ubuntu 20.04, python 3.8.10, have updated the firmware on the cameras to the latest version, limited the DeviceLinkThroughput, and have increased the usbfs buffer size. Please let me know if there is any additional information that I can provide that may be of use.

pjmara commented 7 months ago

Have you had any success? Or did you have to change over to C / C++ impl