Error Codes#
如果发生几个不同的错误,则将它们存储在错误列表中,并可以一一检索。
该功能的使用#
运作原理#
相机可以检测错误状态。如果发生此类错误,相机会为此错误分配一个错误代码,并将错误代码存储在内存中。
如果发生了几种不同的错误,相机将存储检测到的每种错误的代码。相机仅将每个代码存储一次,而不管它检测到相应错误的次数。
检查 Error Codes#
检查 Error Codes 是一个反复迭代的过程,具体取决于您的相机型号和发生了多少个错误。
ace 2、boost、dart M/R 和 racer 2 相机#
Basler ace 2、boost、dart M/R 和 racer 2 相机可以生成错误列表,以便 Basler 支持团队进行评估。
要在 ace 2、boost、dart M/R 和 racer 2 相机上检查 Error Codes:
- 获取
BslErrorPresent参数。 - 如果参数值为
true:- 获取
BslErrorReportValue参数。 - 将值存储在您的计算机上或将其记录下来以备将来参考。
- 执行
BslErrorReportNext命令。这会从设备检索下一个 Error Code。 - 重复步骤 a) 至 c),直到
BslErrorReportValue参数值为0。参数值为 0 意味着没有更多要检索的 Error Code。 - 请联系 Basler 支持团队并提供 error codes 列表。
- 获取
ace U/L 相机#
Basler ace U/L 相机可以生成错误列表,您可以自行纠错或由 Basler 支持团队进行评估。
要在 ace U/L GigE 相机上检查 Error Codes:
- 获取
LastError参数。 - 将值存储在您的计算机上或将其记录下来以备将来参考。
- 执行
ClearLastError命令。这会从 Error Codes 列表中删除最后一个 Error Code。 - 重复步骤 1) 至 3),直到
LastError参数值为NoError. - 使用下表纠正错误,或联系 Basler 支持部门以获取 Error Codes 列表。
可用错误代码#
下表仅适用于 Basler ace U/L 相机。
| LastError 枚举器 | 含义 |
|---|---|
| NoError | 自上次清除错误内存以来,相机未检测到任何错误。 |
| Overtrigger | 发生了过触发。 当相机尚未准备好时,用户向相机发送了触发信号。 |
| Userset | 尝试加载用户设置集时发生错误。通常,这意味着用户设置集包含无效值。请尝试加载其他用户设置集。 |
| InvalidParameter | 输入的参数超出范围或无效。通常,仅当用户通过直接寄存器访问设置参数时,才会发生此错误。 |
| OverTemperature | 相机支持 Temperature State 功能并超过了超温阈值。该错误表明可能会损坏相机组件。 |
| PowerFailure | 此错误表明供电不足。 请检查电源。 |
| InsufficientTriggerWidth | 当触发时间短于最短曝光时间的情况下,在触发宽度曝光模式下报告此错误。 |
示例代码#
ace 2、boost、dart M 和 dart R 相机#
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 轻松设置参数。