跳至內容
測試伺服器
開發伺服器

Error Codes#

透過 Error Codes camera feature,您可以從相機讀取 error codes。

如果發生多種不同的錯誤,它們會儲存在錯誤清單中,並且可以逐一擷取。

使用此功能#

運作原理#

相機可以偵測特定錯誤。若發生此類錯誤,相機將會為該錯誤指派一個 error code,並將其儲存在 memory 中。

如果發生多種不同的錯誤,相機會儲存所偵測到的每種類型錯誤的代碼。無論偵測到相應錯誤多少次,相機每個代碼都只儲存一次。

檢查 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:

  1. 取得 BslErrorPresent 參數的值。
  2. 如果參數值為 true:
    1. 取得 BslErrorReportValue 參數的值。
    2. 將數值儲存在您的電腦上或記下來以便日後參考。
    3. 執行 BslErrorReportNext 指令。這會從裝置擷取下一個 error code。
    4. 重複步驟 a) 至 c),直到 BslErrorReportValue 參數值為 0。參數值為 0 表示已無其他 error codes 可擷取。
    5. 請隨附 error codes 清單聯絡 Basler 支援團隊。

ace U/L 相機#

Basler ace U/L 相機可以產生錯誤清單,供您自行修正或由 Basler 支援團隊進行評估。

若要檢查 ace U/L GigE 相機上的 error codes:

  1. 取得 LastError 參數的值。
  2. 將數值儲存在您的電腦上或記下來以便日後參考。
  3. 執行 ClearLastError 指令。這會從 error codes 清單中刪除最後一個 error code。
  4. 重複步驟 1) 至 3),直到 LastError 參數值為 NoError.
  5. 使用 下表 進行錯誤排除,或將 error codes 清單提供給 Basler 支援團隊。
可用的 Error Codes#

下表僅適用於 Basler ace U/L 相機。

LastError Enumerator 含義
NoError 自上次清除 error memory 以來,相機未偵測到任何錯誤。
Overtrigger 發生 overtrigger。
當相機尚未準備好時,使用者向相機發送了觸發訊號。
User Sets 嘗試載入 User Sets 時發生錯誤。通常這表示 User Sets 包含無效值。請嘗試載入不同的 User Sets。
InvalidParameter 輸入了超出範圍或無效的 Property。通常此錯誤僅在使用直接暫存器存取設定 Property 時發生。
OverTemperature 相機支援 Temperature State 功能,且溫度已超過 over temperature threshold。此錯誤表示相機零件可能會受損。
PowerFailure 此錯誤表示電源供應不足。
請檢查電源供應。
InsufficientTriggerWidth 當觸發訊號小於最短 Exposure Time 時,系統會在 Trigger Width exposure mode 中回報此錯誤。

範例程式碼#

ace 2、boost、dart M 與 dart R 相機#
// 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 來輕鬆設定參數。