basler / pypylon-samples

BSD 3-Clause "New" or "Revised" License
40 stars 14 forks source link

Error "e1000014" Encountered During Basler Camera Image Capturing #4

Open GilbertPan97 opened 1 year ago

GilbertPan97 commented 1 year ago

Hello Basler team,

I encountered the "Error: e1000014" while using a Basler camera for image capturing. The error message suggests that the buffer was incompletely grabbed and mentions possible causes related to network hardware performance. I've attempted to increase the number of buffers, but it resulted in getting duplicate images whenever I execute the grabbing process. Is there any specific solution or recommendation to address this issue?

The environment for the code execution is as follows:

1) Operating System: The code is running on a PC with the Linux operating system.

2) Network Interface: The PC is equipped with a network interface that supports a maximum speed of 100 Mbps (100 Megabits per second). This means the network adapter or Ethernet port on the PC supports the Fast Ethernet (FE) standard.

3) Maximum Buffer Setting: The code is configured to use a maximum buffer setting of 1. This indicates that only one buffer is used for image capturing during each loop iteration.

4) Industrial Ethernet Switch with POE: The network setup includes an industrial Ethernet switch with Power over Ethernet (POE) capability. POE allows the switch to provide power to devices (such as cameras) over the Ethernet cable, eliminating the need for separate power cables for these devices.

5) Dedicated POE Ethernet Cable: The network setup includes dedicated POE Ethernet cables to connect the Basler camera (or other POE-enabled devices) to the industrial Ethernet switch.

Despite trying a machine with a 1000 Mbps (Gigabit Ethernet) network interface, using a dedicated POE-enabled industrial Ethernet switch and cable, and setting the buffer size to 1 for each image capture, the "e1000014" error persists. This error might still occur due to other factors affecting the image capturing process, and further investigation might be needed to pinpoint the root cause of the problem.

Sample code is as follow (Note: The problem still exists when MaxNumBuffer = 10):

// Before using any pylon methods, the pylon runtime must be initialized.
PylonInitialize();
// Create an instant camera object with the camera device found first.
CInstantCamera camera( CTlFactory::GetInstance().CreateFirstDevice() );
// Print the model name of the camera.
std::cout << "Using device " << camera.GetDeviceInfo().GetModelName() << endl;
// The parameter MaxNumBuffer can be used to control the count of buffers
// allocated for grabbing. The default value of this parameter is 10.
camera.MaxNumBuffer = 1; 
// This smart pointer will receive the grab result data.
CGrabResultPtr ptrGrabResult;
// Start the grabbing of c_countOfImagesToGrab images.
// The camera device is parameterized with a default configuration which
// sets up free-running continuous acquisition.
camera.StartGrabbing();
// Set camera exposure time 
auto& nodemap = camera.GetNodeMap();
double minLowerLimit = CFloatParameter(nodemap, "AutoExposureTimeLowerLimit").GetMin();
double maxUpperLimit = CFloatParameter(nodemap, "AutoExposureTimeUpperLimit").GetMax();
CFloatParameter(nodemap, "AutoTargetBrightness").SetValue(0.6);         // Set the target brightness value to 0.6
CEnumParameter(nodemap, "AutoFunctionROISelector").SetValue("ROI1");    // Select auto function ROI 1    
CBooleanParameter(nodemap, "AutoFunctionROIUseBrightness").SetValue(true);      // Enable the 'Brightness' auto function
CEnumParameter(nodemap, "ExposureAuto").SetValue("Continuous");  
// Wait for an image and then retrieve it. A timeout of 5000 ms is used.
camera.RetrieveResult( 5000, ptrGrabResult, TimeoutHandling_ThrowException);
if (!ptrGrabResult->GrabSucceeded())
{
    std::cout << "Error: " << std::hex << ptrGrabResult->GetErrorCode() 
              << std::dec << " " << ptrGrabResult->GetErrorDescription() << std::endl;
}

Error message is:

Error: e1000014 The buffer was incompletely grabbed. This can be caused by performance problems of the network hardware used, i.e., the network adapter, switch, or Ethernet cable. Buffer underruns can also cause image loss. To fix this, use the pylonGigEConfigurator tool to optimize your setup and use more buffers for grabbing in your application to prevent buffer underruns.