Light Control#
此功能基於 SLP 協定,該協定使攝影機與照明設備能夠直接相互通訊。
若您使用Basler Light或他家製造商的LED 照明解決方案,則需搭配BaslerSLP Strobe Controller,才能讓相機與照明設備之間建立通訊連結。
若您使用Basler 的 Camera Light ,則無需額外控制器,因為該控制器已內建相關功能。
資訊
對於dart M 相機模組,目前僅當您使用 Basler dart M 介面板(無論是dart M GigE RJ45 PoE 介面板,還是dart M GigE RJ45 AUX 介面板)時,才可使用Light Control 功能。
使用功能#
設定照明裝置#
要設定您的照明裝置:
-
使用 pylon Viewer時,請確保已選取「功能」窗格中的「汲取」選項:

-
請確認相機處於閒置狀態,也就是說,目前並未進行影像擷取。
- 若您尚未進行此步驟,請將照明設備與控制器連接起來。
- 將相機中的
BslLightControlMode參數設為On. - 執行
BslLightControlEnumerateDevices指令。
這使得光學裝置能夠透過 GPIO 線 並賦予一個 照明裝置識別碼. - 如果你有 多個 若您所在環境中有照明設備,請將
BslLightDeviceSelector將參數傳遞至您要設定的裝置。
請確保裝置已正確連接,也就是說,該BslLightDeviceErrorStatus參數回傳值NoError. -
若您使用的是 BaslerSLP Strobe Controller :
- 將相機中的
BslLightDeviceControlMode參數設為Current. - 將相機中的
BslLightDeviceOperationMode參數設為Off. -
將相機中的
BslLightDeviceMaxCurrent請將參數設定為您的燈具在連續運作時的額定電流(單位:mA)。注意事項——若指定過高的額定電流,將會損壞您的燈具。
使用電流控制時,請務必指定燈具所能承受的額定電流值。
否則,您的燈具在運作過程中將會受損。
- 將相機中的
-
將相機中的
BslLightDeviceBrightness將參數調整至所需的亮度。
數值 100.0 相當於您照明裝置額定電流的 100%。50% 表示電流減少一半。您也可以將亮度設定為超過 100%。這稱為 過度驅動. - 將相機中的
BslLightDeviceOperationMode將參數設定為所需模式:On: 使燈光持續發亮。Strobe: 將燈光設定為 閃光模式.
- 若需要,請將設定儲存至使用者設定集。
資訊
- 若您使用 Basler 的Camera Light ,則
BslLightDeviceControlMode進行明確的生命週期管理即呼叫BslLightDeviceMaxCurrent參數會自動設定。 - 每次在電流與電壓之間切換時,控制器都會經歷一個短暫的初始化階段,在此期間,連接的燈具會亮起。此過程最長可能持續 15 秒,屬於正常現象。
閃光模式#
閃光模式讓您能在需要時將照明裝置(例如閃光燈)以閃光方式運作,而非持續運作。
使用閃光模式具有以下優點:
- 這有助於延長燈具的使用壽命。透過僅在需要時才開啟燈具,LED 所產生的熱量便會減少,從而延緩燈具的老化過程。
- 在閃光模式下,您可以對燈具進行過驅動,也就是將供應的電流增加至最高 500 %(針對燈光控制器而言),藉此提升燈具的亮度。
若要啟用閃光模式,請選取一盞燈具,並將 BslLightDeviceOperationMode 參數設為 Strobe.
設定觸發訊號與脈衝持續時間#
一般來說,觸發照明裝置的運作方式如下:
- 起初,燈是熄滅的。
- 燈光是由觸發訊號所開啟的。
- 燈光會持續亮起一段時間,這段時間就是閃光持續時間。
- 閃光持續時間結束後,燈光便會再次熄滅。
ace 2、boost R 以及 dart M 相機#
若要設定 ace 2、boost R 以及 dart M 攝影機的觸發訊號與脈衝持續時間:
- 將相機中的
BslLightControlTriggerSource要設定為用來開啟已連接燈具的來源參數,例如:FlashWindow. - 如果適用,請設定
BslLightControlTriggerActivation參數設定為以下值之一:RisingEdge(預設):當信號發出時,所有已連接的燈具都會亮起 上升時 Timer 即會啟動,亦即信號狀態從低電位變為高電位時。FallingEdge: 當訊號發出時,所有已連接的燈光都會亮起 下降時 Timer 即會啟動,亦即信號狀態從高電位變為低電位時。AnyEdge: 當訊號發出時,所有已連接的燈光都會亮起 下降或上升.
- 將相機中的
BslLightDeviceStrobeMode參數設定為以下值之一:Automatic: 閃光持續時間由相機的閃光視窗持續時間所控制(BslFlashWindowDuration參數)。該BslLightDeviceStrobeDuration該參數將轉為唯讀狀態,並顯示計算出的脈衝持續時間。Manual: 您可以透過BslLightDeviceStrobeDuration參數中選擇性地指定 HTML 記錄檔 (*.html) 的路徑與檔名。
- 如果您選擇了
Manual閃光模式,請設定BslLightDeviceStrobeDuration將此參數設定為所需的閃光持續時間(單位為微秒)。
資訊
- 若您正在使用「觸發寬度」曝光模式或 Exposure Auto 自動功能時,請勿使用「自動閃光燈」模式。否則,相機與燈光可能會出現難以預期的運作狀況。
- 若您正在使用 Sequencer 此功能時,將無法使用「自動閃光燈模式」。
- 在「自動閃光模式」下,計算出的閃光持續時間可能會比閃光視窗的持續時間短。這是為了補償燈光開啟所需的時間,也就是所謂的開啟延遲。
- 若您將相機的運作推至其性能上限,可能會發生過度觸發的情況。
ace U/L 相機#
要在 ace U/L 攝影機上設定觸發訊號和觸發脈衝持續時間:
-
如果您使用的是 捲簾門 相機,設定
BslLightControlTriggerMode參數設定為以下值之一:ExposureActive: 曝光開始時,所有連接的燈光都會亮起。請僅在您沒有……的情況下使用此模式 重疊 影像擷取。FlashWindow: 當攝影機的 Flash 視窗 訊號上升。若使用此模式,請確認您的相機型號支援「閃光視窗」訊號。
在全域快門相機上,當曝光開始時,所有連接的燈光都會立即開啟。
-
將相機中的
BslLightDeviceStrobeMode參數設定為以下值之一:Automatic: 閃光持續時間由ExposureTime相機的參數。Manual: 您可以透過BslLightDeviceStrobeDuration參數中選擇性地指定 HTML 記錄檔 (*.html) 的路徑與檔名。
- 如果您選擇了
Manual閃光模式,請設定BslLightDeviceStrobeDuration將參數設定為所需的閃光持續時間。
資訊
- 若您使用「觸發寬度」曝光模式,則無法使用「自動閃光」模式, Sequencer 功能,或 Gain Auto 或 Exposure Auto 自動功能時,將無法使用自動閃光模式。
- 若您將相機的運作推至其性能上限,可能會發生過度觸發的情況。
光學元件的過驅動#
注意事項——過度驅動可能會損壞您的燈具。
請仔細閱讀本節中的說明,以避免損壞連接的燈具,並確保燈具不會過早老化。
所謂「過驅動」燈具,是指當燈具處於閃光模式時,您可以增加電流,從而提升光照強度。
要讓照明裝置過載:
-
如果您使用的是Basler 光源或第三方光源裝置:
- 根據當前的占空比和脈衝持續時間,計算裝置的最大允許電流。在 Basler ace 2、boost R 以及 dart M 相機上,您可以讀取
BslLightDeviceDutyCycle用於決定當前占空比的參數。 - 將相機中的
BslLightDeviceOverdriveLimit請據此調整參數。例如,若您的燈具能承受其額定電流的 200%,請將過載限制設定為 200.0。
如果您使用的是 巴斯勒Camera Light, 過載限制會自動計算,而
BslLightDeviceOverdriveLimit此參數不可用。 - 根據當前的占空比和脈衝持續時間,計算裝置的最大允許電流。在 Basler ace 2、boost R 以及 dart M 相機上,您可以讀取
-
將相機中的
BslLightDeviceBrightness設定為大於 100.0 的數值。
進行過載駕駛時,請考慮以下幾點,以避免損壞車燈:
- 如果您不確定您的燈具在閃光模式下能承受的最大電流是多少,請向製造商查詢。
- 由於電流增加會導致 LED 發熱加劇,因此必須在每個閃光脈衝之間預留足夠的時間,讓燈光有時間冷卻下來。一般來說,脈衝強度越高,脈衝之間的間隔時間就應該越長。
- 請考慮曝光時間,因為這會影響脈衝的長度與占空比。
安全功能#
Basler 照明裝置已實施以下安全功能,以避免硬體受損:
SLP 照明控制器的安全功能#
當電流超過 2 A,且同時伴隨長時間曝光與高占空比時,可能會損壞控制器硬體。
為避免這種情況,您不能設定額定電流(BslLightDeviceMaxCurrent Basler SLP 光源控制器的(參數)可提升至超過 2000 mA。
然而,若您讓裝置超載運作,電流可能會超過 2 A。
在此情況下,相機會自動調整某些光源設定的最大值。請參閱下表。
| 輸出電流(額定電流 × 亮度(%)) | 最大閃光持續時間 | 最大工作週期 |
|---|---|---|
| 2 A 以下 | - | 100 % |
| 2 A to <3 A | 5 毫秒 | 15 % |
| 3 A to <4 A | 5 毫秒 | 8 % |
| 4 A to <5 A | 5 毫秒 | 6 % |
| 5 A to <6 A | 5 毫秒 | 4 % |
| 6 A to <8 A | 1 毫秒 | 4 % |
| 8 A to <9 A | 1 毫秒 | 3 % |
| 9 A to <10 A | 1 毫秒 | 2 % |
安全功能Camera Lights#
在 BaslerCamera Lights 上,若所選的亮度相对于閃光持續時間和工作週期而言過高,則閃光持續時間將會縮短,或觸發訊號將被忽略。請參閱下表。
| 所需亮度 | 最大閃光持續時間 | 最大工作週期 |
|---|---|---|
| 0–100 % | - | 100 % |
| 101–200 % | 30 毫秒 | 30 % |
| 201–300 % | 10 毫秒 | 20 % |
| 301–500 % | 2 毫秒 | 10 % |
| 501–1000 % | 1 毫秒 | 5 % |
GPIO 線路設定#
相機是透過其中一條 GPIO 線路與燈光裝置進行通訊:
-
開啟 ace 2、boost R 以及 dart M 相機, 相機總是使用 Line 3 用於光通訊。因此,當啟用「Light Control 」功能時,該 行模式 第 3 行的設定為
InOut及 線路連接 設為LightControl. -
開啟 ace U/L 攝影機,
BslLightControlSource此參數顯示相機使用哪條 GPIO 線進行光通訊。
照明設備識別碼#
每個透過 SLP 協定連接的照明裝置都具有一個照明裝置識別碼。該識別碼儲存於裝置中。
有效的照明裝置 ID 為 1、2、3、4 及 7。所有裝置出廠時,其 ID 均預設為 7(工廠預設值)。
在使用 BslLightControlEnumerateDevices 執行此指令後,相機會自動搜尋 ID 設定為 7 的裝置,並為其指派 1 至 4 之間下一個可用的 ID。
當使用多台照明裝置時,必須確保它們的 ID 均不相同。若使用 ID 相同的裝置,將會導致通訊錯誤。
- 範例 1:假設您連接了一台新的照明裝置,並執行裝置清點。攝影機會為該裝置指派 ID 1。接著,您斷開該裝置的連接,連接下一台照明裝置,並再次執行裝置清點。攝影機也會為這台裝置指派 ID 1。
- 範例 2:假設您連接了兩台新的照明裝置,並執行裝置枚舉。攝影機偵測到兩台 ID 皆設定為 7 的裝置,並分別將下一個可用的 ID(即 1)指派給這兩台裝置。
在這兩個範例中,當您將兩台照明裝置都連接至攝影機時,將會發生通訊錯誤。您必須變更其中一個 ID 才能解決此衝突。
提示
預防衝突的最佳方法是依序連接裝置,並且在連接完一個裝置後,務必為其指派一個新的、唯一的 ID。
變更照明裝置識別碼#
若要變更燈具的 ID:
- 將相機中的
BslLightControlMode參數設為On. - 將相機中的
BslLightDeviceOperationMode參數設為Off. - 將相機中的
BslLightDeviceSelector要變更其 ID 的 Basler 光源裝置的參數。 - 將相機中的
BslLightDeviceChangeID將參數設定為所需的 ID,例如:Device1.
開啟 ace U/L 攝影機, 識別碼會立即變更。 - 開啟 ace 2、boost R 以及 dart M 相機, 執行該
BslLightDeviceNewIDSave指令。
使用「Light Control 」功能時的注意事項#
- 當
BslLightControlMode設為On, Serial Communication 此功能已停用。這是因為「Light Control 」功能同樣使用序列通訊。 - Basler Camera Lights use pulse width modulation (PWM), the Basler SLP Strobe Controller doesn't. If you're using very short exposure times (<500 µs) and a brightness value other than 100 %, PWM can lead to brightness fluctuations or to stripes in rolling shutter cameras.
- 請避免使用過短的「閃爍視窗」訊號。否則,生成的影像中,某些線條可能會過亮,而其他線條則可能過暗。
- 在設定
BslLightControlMode參數設為On, 實際開啟光源裝置前會有長達 1 秒的延遲。因此,第一張影像可能會過暗。您可以選擇捨棄這張影像,或者,若您需要所有影像,請在適當的延遲後再開始擷取影像。 - 在對BaslerCamera Light進行超驅動時,請勿讓相機的運作幀率超過每秒 60 幀。否則,相機和光源可能會出現無法預期的行為。
- Basler ace 2、boost R 及 dart M 攝影機:當從 使用者設定, 這些設定僅會在執行
BslLightControlEnumerateDevices指令。
過度觸發#
若您將相機操作至其性能上限,可能會發生閃光裝置「過早觸發」的情況。所謂「過早觸發」,是指閃光裝置在尚未準備就緒時便接收到觸發訊號,例如因閃光裝置仍處於關閉閃光燈的過程中。這將導致該觸發訊號被忽略,使得閃光燈在下次曝光時無法亮起。
為了更深入理解這個問題,請參考以下例子。
一台具備每秒 100 幀(fps)拍攝能力的相機,其曝光時間設定為 50 毫秒。因此,該相機每秒可連續拍攝 20 幀,且兩次曝光之間毫無停頓。這意味著,光源裝置的觸發時機必須精確落在兩次曝光的交界處。
實際上,這幾乎是不可能的,因為存在一種固有的抖動,導致觸發訊號有時會在燈光尚未完全熄滅時就已送達。在這種情況下,觸發訊號將會被忽略,而最終成像的畫面將會過暗。
由於抖動是隨機發生的,因此沒有精確的方法可以防止這種情況發生。如果您發現部分影像比其他影像更暗,請考慮將燈光切換至連續模式。您也可以嘗試使用 Acquisition Frame Rate 功能來調整幀率。
監控過度觸發#
開啟 ace 2、boost R 以及 dart M 相機, BslLightControlOvertriggerCount 此參數已提供。它可讓您監控,當至少有一台已連接的照明裝置尚未準備好接收觸發訊號時,系統共發送了多少觸發訊號。
範例: 假設您的相機連接了 4 個光源裝置。當您發送觸發訊號時,其中 3 個裝置尚未準備好接收該訊號。因此, BslLightControlOvertriggerCount 該參數增加 1。
該參數會累計至最大值 65 535,之後便停止計數。
若要重設過觸發計數器,請執行 BslLightControlOvertriggerCountReset 指令。
檢查與清除錯誤#
ace 2、boost R 以及 dart M 相機#
Basler ace 2、boost R 以及 dart M 相機可從連接的照明裝置讀取以下錯誤資料:
- 錯誤狀態可協助您自行修正錯誤。
- 此錯誤代碼提供了有關錯誤類型的額外資訊,可由 Basler 技術支援團隊進行評估。
要檢查並清除錯誤:
- 如果您已連接多台裝置:
- 請檢查
BslLightControlErrorSummary參數,用以查明哪個裝置出現問題,例如:Device2. - 將相機中的
BslLightDeviceSelector將該參數傳送至發生問題的裝置。
- 請檢查
- 取得
BslLightDeviceErrorStatus參數,並在 錯誤狀態 下表。 - 如果錯誤狀態為「硬體錯誤」:
- 執行
BslLightDeviceErrorStatusReadAndClear指令。 - 取得
BslLightDeviceErrorCode參數,並在 Error Codes 下表。 - 如果可能的話,請修正這個錯誤。
- 執行
- 如果錯誤狀態並非「硬體錯誤」:
- 如果可能的話,請修正這個錯誤。
- 執行
BslLightDeviceErrorStatusReadAndClear用於將錯誤狀態重設為NoError.
錯誤狀態#
當 BslLightDeviceErrorStatus 該參數可取以下值:
| Value | 含意 |
|---|---|
| 通訊錯誤 | 若光源裝置與相機之間的資料傳輸出現故障,便會發生通訊錯誤。這可能是因為使用了過長的纜線,或是線路上的雜訊過多所致。 |
| 連線中斷 | 與先前已連接的照明裝置的連線已中斷。例如,若電纜鬆脫,便可能發生這種情況。 |
| 硬體錯誤 | 該照明裝置正發生技術故障。若要瞭解有關此類硬體錯誤的更多資訊,請執行 BslLightDeviceErrorStatusReadAndClear 用於擷取一個 錯誤代碼.a |
| 照明裝置錯誤 | 該照明裝置發生內部錯誤。a |
| 無錯誤 | 未偵測到任何錯誤。 |
| 未連線 | 該照明裝置尚未連接至相機,或尚未完成清點。請執行 BslLightControlEnumerateDevices 用於枚舉該裝置的指令。 |
| 不支援的裝置版本 | 此照明裝置與目前的相機不相容。請聯絡客服,以確認是否有韌體更新可用。 |
Error Codes#
當 BslLightDeviceErrorCode 該參數可取以下值:
| Value | 含意 |
|---|---|
| 0x30024 | 燈光控制器的照明連接器發生短路。這可能是由於燈具故障所致。 |
| 0x3002A | 燈光控制器無法提供所需的電流。請嘗試降低 BslLightDeviceCurrent 參數值。 |
| (其他) | 請將錯誤代碼提供給 Basler 技術支援部門。 |
ace U/L 相機#
Basler ace U/L 攝影機可讀取來自連接之照明裝置的錯誤清單。
最多可儲存 25 項錯誤。若發生第 26項錯誤,系統將覆寫最舊的錯誤紀錄,以此類推。
檢查與清除錯誤是一個迭代過程,具體取決於發生了多少個錯誤。
要檢查並清除錯誤:
- 如果您已連接多台裝置:
- 請檢查
BslLightControlErrorStatus參數,用以查明哪個裝置出現問題,例如:Device2. - 將相機中的
BslLightDeviceSelector將該參數傳送至發生問題的裝置。
- 請檢查
- 取得
BslLightDeviceLastError參數,並參閱下表查閱其含義。 - 請修正相應的錯誤。
- 若要從錯誤清單中刪除最後一個錯誤,請執行
BslLightDeviceClearLastError指令。 - 持續取得並刪除最後一個錯誤,直到
BslLightDeviceLastError參數顯示NoError.
| Value | 含意 |
|---|---|
| 通訊錯誤 | 若光源裝置與相機之間的資料傳輸出現故障,便會發生通訊錯誤。這可能是因為使用了過長的纜線,或是線路上的雜訊過多所致。 |
| 連線錯誤 | 若燈具與攝影機之間的連線中斷,或先前已發生通訊錯誤,將會出現連線錯誤。其他原因可能包括連接鬆動,或是控制器已完全斷開。 |
| 硬體錯誤 | 該照明裝置正發生技術故障。a |
| 電流不足 | 燈光控制器無法提供所需的電流。請嘗試降低 LightDeviceMaxCurrent 參數值。 |
| 無錯誤 | 自從上次清除錯誤記憶體以來,該照明裝置尚未偵測到任何錯誤。 |
| 短路 | 燈光控制器的照明連接器發生短路。這可能是由於燈具故障所致。 |
-
斷開並重新連接電源可能會解決此問題。為確保完成電源重啟,控制器需斷電五分鐘。這是正常現象。若您使用多個控制器,即使其他控制器未發生任何故障,也必須一併進行電源重啟。
範例程式碼#
ace 2、boost R 、dart M 相機#
// Enable the light control mode
camera.BslLightControlMode.SetValue(BslLightControlMode_On);
//Enumerate the light devices
camera.BslLightControlEnumerateDevices.Execute();
//Select light device 1
camera.BslLightDeviceSelector.SetValue(BslLightDeviceSelector_Device1);
//Set the nominal current of device 1 to 100 mA
camera.BslLightDeviceCurrent.SetValue(100.0);
//Set the brightness to 100 %
camera.BslLightDeviceBrightness.SetValue(100.0);
//Set the operation mode to Strobe
camera.BslLightDeviceOperationMode.SetValue(BslLightDeviceOperationMode_Strobe);
INodeMap& nodemap = camera.GetNodeMap();
// Enable the light control mode
CEnumParameter(nodemap, "BslLightControlMode").SetValue("On");
// Enumerate the light devices
CCommandParameter(nodemap, "BslLightControlEnumerateDevices").Execute();
// Select light device 1
CEnumParameter(nodemap, "BslLightDeviceSelector").SetValue("Device1");
// Set the nominal current of device 1 to 100 mA
CFloatParameter(nodemap, "BslLightDeviceCurrent").SetValue(100.0);
// Set the brightness to 100 %
CFloatParameter(nodemap, "BslLightDeviceBrightness").SetValue(100.0);
// Set the operation mode to Strobe
CEnumParameter(nodemap, "BslLightDeviceOperationMode").SetValue("Strobe");
// Enable the light control mode
camera.Parameters[PLCamera.BslLightControlMode].SetValue(PLCamera.BslLightControlMode.On);
// Enumerate the light devices
camera.Parameters[PLCamera.BslLightControlEnumerateDevices].Execute();
// Select light device 1
camera.Parameters[PLCamera.BslLightDeviceSelector].SetValue(PLCamera.BslLightDeviceSelector.Device1);
// Set the nominal current of device 1 to 100 mA
camera.Parameters[PLCamera.BslLightDeviceCurrent].SetValue(100.0);
// Set the brightness to 100 %
camera.Parameters[PLCamera.BslLightDeviceBrightness].SetValue(100.0);
// Set the operation mode to Strobe
camera.Parameters[PLCamera.BslLightDeviceOperationMode].SetValue(PLCamera.BslLightDeviceOperationMode.Strobe);
/* 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 */
/* Enable the light control mode */
errRes = PylonDeviceFeatureFromString(hdev, "BslLightControlMode", "On");
CHECK(errRes);
/* Enumerate the light devices */
errRes = PylonDeviceExecuteCommandFeature(hdev, "BslLightControlEnumerateDevices");
CHECK(errRes);
/* Select light device 1 */
errRes = PylonDeviceFeatureFromString(hdev, "BslLightDeviceSelector", "Device1");
CHECK(errRes);
/* Set the nominal current of device 1 to 100 mA */
errRes = PylonDeviceSetFloatFeature(hdev, "BslLightDeviceCurrent", 100.0);
CHECK(errRes);
/* Set the brightness to 100 % */
errRes = PylonDeviceSetFloatFeature(hdev, "BslLightDeviceBrightness", 100.0);
CHECK(errRes);
/* Set the operation mode to Strobe */
errRes = PylonDeviceFeatureFromString(hdev, "BslLightDeviceOperationMode", "Strobe");
CHECK(errRes);
# Enable the light control mode
camera.BslLightControlMode.Value = "On"
# Enumerate the light devices
camera.BslLightControlEnumerateDevices.Execute()
# Select light device 1
camera.BslLightDeviceSelector.Value = "Device1"
# Set the nominal current of device 1 to 100 mA
camera.BslLightDeviceCurrent.Value = 100.0
# Set the brightness to 100 %
camera.BslLightDeviceBrightness.Value = 100.0
# Set the operation mode to Strobe
camera.BslLightDeviceOperationMode.Value = "Strobe"
您也可以 use the pylon Viewer 來輕鬆設定參數。
ace U/L 相機#
// Enable the light control mode
camera.BslLightControlMode.SetValue(BslLightControlMode_On);
//Enumerate the light devices
camera.BslLightControlEnumerateDevices.Execute();
//Select light device 1
camera.BslLightDeviceSelector.SetValue(BslLightDeviceSelector_Device1);
//Set the nominal current of device 1 to 100 mA
camera.BslLightDeviceMaxCurrent.SetValue(100.0);
//Set the brightness to 100 %
camera.BslLightDeviceBrightness.SetValue(100.0);
//Set the operation mode to Strobe
camera.BslLightDeviceOperationMode.SetValue(BslLightDeviceOperationMode_Strobe);
INodeMap& nodemap = camera.GetNodeMap();
// Enable the light control mode
CEnumParameter(nodemap, "BslLightControlMode").SetValue("On");
// Enumerate the light devices
CCommandParameter(nodemap, "BslLightControlEnumerateDevices").Execute();
// Select light device 1
CEnumParameter(nodemap, "BslLightDeviceSelector").SetValue("Device1");
// Set the nominal current of device 1 to 100 mA
CFloatParameter(nodemap, "BslLightDeviceMaxCurrent").SetValue(100.0);
// Set the brightness to 100 %
CFloatParameter(nodemap, "BslLightDeviceBrightness").SetValue(100.0);
// Set the operation mode to Strobe
CEnumParameter(nodemap, "BslLightDeviceOperationMode").SetValue("Strobe");
// Enable the light control mode
camera.Parameters[PLCamera.BslLightControlMode].SetValue(PLCamera.BslLightControlMode.On);
// Enumerate the light devices
camera.Parameters[PLCamera.BslLightControlEnumerateDevices].Execute();
// Select light device 1
camera.Parameters[PLCamera.BslLightDeviceSelector].SetValue(PLCamera.BslLightDeviceSelector.Device1);
// Set the nominal current of device 1 to 100 mA
camera.Parameters[PLCamera.BslLightDeviceMaxCurrent].SetValue(100.0);
// Set the brightness to 100 %
camera.Parameters[PLCamera.BslLightDeviceBrightness].SetValue(100.0);
// Set the operation mode to Strobe
camera.Parameters[PLCamera.BslLightDeviceOperationMode].SetValue(PLCamera.BslLightDeviceOperationMode.Strobe);
/* 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 */
/* Enable the light control mode */
errRes = PylonDeviceFeatureFromString(hdev, "BslLightControlMode", "On");
CHECK(errRes);
/* Enumerate the light devices */
errRes = PylonDeviceExecuteCommandFeature(hdev, "BslLightControlEnumerateDevices");
CHECK(errRes);
/* Select light device 1 */
errRes = PylonDeviceFeatureFromString(hdev, "BslLightDeviceSelector", "Device1");
CHECK(errRes);
/* Set the nominal current of device 1 to 100 mA */
errRes = PylonDeviceSetFloatFeature(hdev, "BslLightDeviceMaxCurrent", 100.0);
CHECK(errRes);
/* Set the brightness to 100 % */
errRes = PylonDeviceSetFloatFeature(hdev, "BslLightDeviceBrightness", 100.0);
CHECK(errRes);
/* Set the operation mode to Strobe */
errRes = PylonDeviceFeatureFromString(hdev, "BslLightDeviceOperationMode", "Strobe");
CHECK(errRes);
# Enable the light control mode
camera.BslLightControlMode.Value = "On"
# Enumerate the light devices
camera.BslLightControlEnumerateDevices.Execute()
# Select light device 1
camera.BslLightDeviceSelector.Value = "Device1"
# Set the nominal current of device 1 to 100 mA
camera.BslLightDeviceMaxCurrent.Value = 100.0
# Set the brightness to 100 %
camera.BslLightDeviceBrightness.Value = 100.0
# Set the operation mode to Strobe
camera.BslLightDeviceOperationMode.Value = "Strobe"