basler / pypylon

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

Delay using multiple cameras #230

Open CobeA527 opened 4 years ago

CobeA527 commented 4 years ago

Hi Basler - team, I am using 3 Basler GigE acA640-120gm on linux. The cameras are connected via a switch with my Laptop. In the beginning when I was trying to continuously grab images from all 3 cameras the Error 3774873620 occured:

"The buffer was incompletely grabbed. This can be caused by performance problems of the network hardware used, i.e. network adapter, switch, or ethernet cable. To fix this, try increasing the camera's Inter-Packet Delay in the Transport Layer category to reduce the required bandwidth, and adjust the camera's Packet Size setting to the highest supported frame size."

Therefore I decided to set all parameters in the pylon viewer (Inter_Packet Delay = 5000 & Packet Size = 2000 (max)) and changed and set my Ethernet connection to use jumboframes with MTU = 9000. I also limited each cameras bandwidth to 8Mb/s and changed the etc/security/limits.conf file to ensure real-time priority.

After that the Error doesn't occurred anymore but the the image acquisition has a huge delay and the video seems like "slow motion".

Is there anything I can do that I get real-time images/video for every camera ? Do i need different settings or is it a hardware problem ?

Switch: http://www.cudytech.com/productinfo/1451013.html Ethernet cable: https://www.amazon.de/gp/product/B07RTCZN6G/ref=ppx_yo_dt_b_asin_image_o03_s00?ie=UTF8&psc=1 Ethernet adapter: Intel(R) PRO/1000 Network Connection

Thanks for your help!

thiesmoeller commented 4 years ago

you are using a 100MBit switch. as a single acA640-120gm will produce, even in Mono8, 35MB per sec this can't work.

The issue that you see is most probably the following: The switch is not able to transfer the data from all three cameras to your PC. Typically a switch will now issue PAUSE frames to the cameras, to force them to pause the video transfer. As every camera has enough memory to buffer a larger number of VGA frames, you will get them now one by one.

What you observe is the typical behavior of an acquisition and transmission bandwidth mismatch.

Solutions:

CobeA527 commented 4 years ago

Ok, thanks for the fast reply @thiesmoeller ! Is there an option to turn down the acquisition bandwidth for now? The speed of the network card is also 100Mbit/s..

thiesmoeller commented 4 years ago

Please use the bandwidth manager from pylon viewer to find optimal settings for your setup. These have to be applied in your pypylon program afterwards!

https://docs.baslerweb.com/bandwidth-manager.html

TechnoSwiss commented 4 years ago

Was debating between opening a new issue and adding to this one, but given the error message is identical I'll go ahead and put my question here.

I'm running into this same error trying to run the grab.py demo code. I know values I need to set Inter-Packet Delay and Frame Transmission Delay to (and Brandwidth Reservation) based on testing with Bandwidth-Manager and pylon Viewer, however I haven't been able to find documentation or examples on how to set those values in pypylon, am I missing something? Thanks.

thiesmoeller commented 4 years ago

For every feature you control in pylon viewer there is a c++ help in the documentation window of pylon viewer.

Python is nearly 1:1to c++.

camera.Gain = 42;

camera.Gain = 42

... The controls that the bandwidth tool optimizes are in the 'TransportLayer' section

TechnoSwiss commented 4 years ago

That did the trick, thanks!