Error Codes#
如果发生几个不同的错误,则将它们存储在错误列表中,并可以一一检索。
该功能的使用#
运作原理#
相机可以检测错误状态。如果发生此类错误,相机会为此错误分配一个错误代码,并将错误代码存储在内存中。
如果发生了几种不同的错误,相机将存储检测到的每种错误的代码。相机仅将每个代码存储一次,而不管它检测到相应错误的次数。
检查 Error Codes#
检查 Error Codes 是一个反复迭代的过程,具体取决于您的相机型号和发生了多少个错误。
ace 2, boost, dart M/R, and racer 2 Cameras#
Basler ace 2, boost, dart M/R, and racer 2 cameras can generate a list of errors that can be evaluated by Basler support.
To check error codes on ace 2, boost, dart M/R, and racer 2 cameras:
- 获取
BslErrorPresent
参数的值。 - 如果参数值为
true
:- 获取
BslErrorReportValue
参数的值。 - 将值存储在您的计算机上或将其记录下来以备将来参考。
- 执行
BslErrorReportNext
命令。这将从设备中检索下一个错误代码。 - 重复步骤 a) 至 c),直到
BslErrorReportValue
参数值为0
。参数值 0 表示没有更多的 Error Codes 可检索。 - 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:
- 获取
LastError
参数的值。 - 将值存储在您的计算机上或将其记录下来以备将来参考。
- 执行
ClearLastError
命令。这将从 Error Codes 列表中删除最后一个错误代码。 - 重复步骤 1) 至 3),直到
LastError
参数值为NoError
。 - 使用下表纠正错误,或联系 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, dart M and dart R Cameras#
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);
ace U/L 相机#
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);
您也可以使用 pylon Viewer 轻松设置参数。