跳转到内容

Error Codes#

通过相机的 Error Codes 功能,您可从相机中读取错误状态。

如果发生几个不同的错误,则将它们存储在错误列表中,并可以一一检索。

该功能的使用#

运作原理#

相机可以检测错误状态。如果发生此类错误,相机会为此错误分配一个错误代码,并将错误代码存储在内存中。

如果发生了几种不同的错误,相机将存储检测到的每种错误的代码。相机仅将每个代码存储一次,而不管它检测到相应错误的次数。

检查 Error Codes#

检查 Error Codes 是一个反复迭代的过程,具体取决于您的相机型号和发生了多少个错误。

ace 2, boost, and dart R Cameras#

Basler ace 2, boost, and dart R cameras can generate a list of errors that can be evaluated by Basler support.

To check error codes on ace 2, boost, and dart R cameras:

  1. Get the value of the BslErrorPresent parameter.
  2. 如果参数值为 true:
    1. Get the value of the BslErrorReportValue parameter.
    2. 将值存储在您的计算机上或将其记录下来以备将来参考。
    3. Execute the BslErrorReportNext command. This retrieves the next error code from the device.
    4. Repeat steps a) to c) until the BslErrorReportValue parameter value is 0. A parameter value of 0 means that there are no more error codes to retrieve.
    5. Contact Basler support with the list of error codes.

ace U/L 相机#

Basler ace U/L cameras can generate a list of errors that can be corrected by yourself or evaluated by Basler support.

To check error codes on ace U/L GigE cameras:

  1. Get the value of the LastError parameter.
  2. 将值存储在您的计算机上或将其记录下来以备将来参考。
  3. Execute the ClearLastError command. This deletes the last error code from the list of error codes.
  4. Repeat steps 1) to 3) until the LastError parameter value is NoError.
  5. 使用下表纠正错误,或联系 Basler 支持部门以获取 Error Codes 列表。
可用错误代码#

The following table applies to Basler ace U/L cameras only.

LastError 枚举器 含义
NoError 自上次清除错误内存以来,相机未检测到任何错误。
Overtrigger An overtrigger has occurred.
The user has applied a trigger signal to the camera when the camera wasn't ready for it.
Userset 尝试加载用户设置集时发生错误。通常,这意味着用户设置集包含无效值。请尝试加载其他用户设置集。
InvalidParameter 输入的参数超出范围或无效。通常,仅当用户通过直接寄存器访问设置参数时,才会发生此错误。
OverTemperature 相机支持 Temperature State 功能并超过了超温阈值。该错误表明可能会损坏相机组件。
PowerFailure 此错误表明供电不足。
请检查电源。
InsufficientTriggerWidth 当触发时间短于最短曝光时间的情况下,在触发宽度曝光模式下报告此错误。

示例代码#

ace 2, boost, and dart R Cameras#
// Check whether an error occurred on the device
bool errorPresent = camera.BslErrorPresent.GetValue();
// Get the first error code
int64_t errorReportValue = camera.BslErrorReportValue.GetValue();
// Retrieve the next error code from the device
camera.BslErrorReportNext.Execute();
INodeMap& nodemap = camera.GetNodeMap();
// Check whether an error occurred on the device
bool errorPresent = CBooleanParameter(nodemap, "BslErrorPresent").GetValue();
// Get the first error code
int64_t errorReportValue = CIntegerParameter(nodemap, "BslErrorReportValue").GetValue();
// Retrieve the next error code from the device
CCommandParameter(nodemap, "BslErrorReportNext").Execute();
// Check whether an error occurred on the device
bool errorPresent = camera.Parameters[PLCamera.BslErrorPresent].GetValue();
// Get the first error code
Int64 errorReportValue = camera.Parameters[PLCamera.BslErrorReportValue].GetValue();
// Retrieve the next error code from the device
camera.Parameters[PLCamera.BslErrorReportNext].Execute();
/* Macro to check for errors */
#define CHECK(errc) if (GENAPI_E_OK != errc) printErrorAndExit(errc)
GENAPIC_RESULT errRes = GENAPI_E_OK;  /* Return value of pylon methods */
_Bool errorPresent = false;
int64_t errorReportValue = 0;
/* Check whether an error occurred on the device */
errRes = PylonDeviceGetBooleanFeature(hdev, "BslErrorPresent", &errorPresent);
CHECK(errRes);
/* Get the first error code */
errRes = PylonDeviceGetIntegerFeature(hdev, "BslErrorReportValue", &errorReportValue);
CHECK(errRes);
/* Retrieve the next error code from the device */
errRes = PylonDeviceExecuteCommandFeature(hdev, "BslErrorReportNext");
CHECK(errRes);
# Check whether an error occurred on the device
errorPresent = camera.BslErrorPresent.Value
# Get the first error code
errorReportValue = camera.BslErrorReportValue.Value
# Retrieve the next error code from the device
camera.BslErrorReportNext.Execute()
ace U/L 相机#
// Get the value of the last error code in the memory
LastErrorEnums lasterror = camera.LastError.GetValue();
// Clear the value of the last error code in the memory
camera.ClearLastError.Execute();
INodeMap& nodemap = camera.GetNodeMap();
// Get the value of the last error code in the memory
String_t lasterror = CEnumParameter(nodemap, "LastError").GetValue();
// Clear the value of the last error code in the memory
CCommandParameter(nodemap, "ClearLastError").Execute();
// Get the value of the last error code in the memory
string lasterror = camera.Parameters[PLCamera.LastError].GetValue();
// Clear the value of the last error code in the memory
camera.Parameters[PLCamera.ClearLastError].Execute();
size_t len = 0;
char lasterror_str[64] = {0};
/* Get the value of the last error code in the memory */
len = sizeof(lasterror_str);
errRes = PylonDeviceFeatureToString(hdev, "LastError", lasterror_str, &len);
CHECK(errRes);
/* Clear the value of the last error code in the memory */
errRes = PylonDeviceExecuteCommandFeature(hdev, "ClearLastError");
CHECK(errRes);
# Get the value of the last error code in the memory
lasterror = camera.LastError.Value
# Clear the value of the last error code in the memory
camera.ClearLastError.Execute()

您也可以使用 pylon Viewer 轻松设置参数。