跳转到内容
暂存服务器
开发服务器

Light Control (ace U/L)#

使用 Light Control camera feature,您可以控制最多 4 个照明设备。

该功能所基于的 SLP 协议支持相机和光源设备直接相互通信。

本主题介绍 Basler ace U/L 相机的 Light Control 功能,以及在过渡期内 Basler ace 2、boost R 和 dart M 相机的 Light Control 功能。

信息

  • 如果您使用的光源没有内部 SLP 控制器,则需要一个外部控制器(例如 Basler SLP Strobe Controller),以便在相机和光源之间进行通信。
  • 如果您使用 Basler Camera Light,由于其中已经包含了控制器功能,因此不需要单独的控制器。

Basler 补光灯(修订版 05 之前和之后)#

信息

要确定 Basler Light 是否具有集成光控 (ILC),请检查灯具上的版本号。订购号后面的最后两位数字表示版本。例如,在 2200000841-05 中,版本为 05。

  • 版本 05 或更高版本:该灯具带有 ILC 和集成控制器。
  • 版本 05 以下:该灯具不带 ILC。它需要外部光控器。

当前的 Basler Product Documentation 中不再包含不带 ILC 的 Basler Lights 的文档。有关这些灯具的信息,请点击此处下载早期版本的离线文档。

ace 2、boost R 和 dart M 相机的过渡期#

在引入 Peripheral Devices Control 功能期间,ace 2、boost R 和 dart M 相机在出厂时可能搭载旧版固件,或者搭载已包含 Peripheral Devices Control 功能的固件。

因此,存在两个关于 Light Control 的主题:

  • Light Control (ace U/L):
    本主题适用于继续使用不包含 Peripheral Devices Control 功能的固件的 ace U/L 相机。Basler ace U/L 相机不会迁移到新的固件架构。
    它还适用于在过渡期内出厂且搭载不包含 Peripheral Devices Control 功能的固件的 ace 2、boost R 和 dart M 相机。
  • Light Control 主题:
    本主题适用于运行包含 Peripheral Devices Control 功能的固件的相机,即 Basler ace 2、boost R 和 dart M 相机。此 Light Control 功能作为 Peripheral Devices Control 功能的一部分进行描述,并与 Optic Control 功能一同介绍。
  • 在过渡期内,ace 2、boost R 和 dart M 相机出厂时可能搭载带有或不带有 Peripheral Devices Control 功能的固件。这些产品系列的相机可以升级到更新的固件版本。如需将相机迁移到新固件,请联系 Basler 支持团队。

该功能的使用#

配置光源设备#

若要将您的照明设备配置为与 Basler ace U/L 相机配合使用或用于某些相机:

  1. 使用 pylon Viewer 时,请确保选择了功能窗格中的轮询选项:

    pylon Viewer 中的轮询选项

  2. 确保相机空闲,即未在捕获图像。

  3. 如果尚未连接照明设备和控制器,请执行连接。
  4. 设置 BslLightControlMode 将参数设置为 On.
  5. 执行 BslLightControlEnumerateDevices 命令。
    这可以通过以下方式启用光源设备通信: GPIO Line 并分配一个 light device ID.
  6. 如果您有 多个 环境中的 Light Control 设备,将 BslLightDeviceSelector 参数设置为您要配置的设备。
    确保设备正确连接,即 BslLightDeviceErrorStatus 参数返回 NoError.
  7. 如果您使用 Basler SLP Strobe Controller:

    1. 设置 BslLightDeviceControlMode 将参数设置为 Current.
    2. 设置 BslLightDeviceOperationMode 将参数设置为 Off.
    3. 设置 BslLightDeviceMaxCurrent 参数设置为灯在连续运行下的额定电流(以 mA 为单位)。

      注意 – 指定过高的标称额定电流会损坏您的光源。

      使用电流控制时,请确保指定您的光源可以承受的标称额定电流。

      否则,您的光源会在工作时损坏。

  8. 设置 BslLightDeviceBrightness 参数设置为所需的亮度。
    100.0 的值对应于您的照明设备额定标称电流的 100%。50% 会将电流降低至原来的 1/2。您还可以将亮度设置得高于 100%。这被称为 过驱动.

  9. 设置 BslLightDeviceOperationMode 参数设置为所需模式:
    • On:使光源持续发光。
    • Strobe:将光源设置为 选通模式.
  10. 如果需要,请将设置保存在用户设置中。

信息

  • 如果您使用的是 Basler Camera Light,则 BslLightDeviceControlMode 和 BslLightDeviceMaxCurrent 参数会自动设置。
  • 在您每次从电流切换到电压时(反之亦然),控制器存在短暂的初始化阶段,在此期间,连接的光源设备将亮起。此阶段可能会持续长达 15 s,这是正常现象。

频闪模式#

频闪模式允许您在需要时操作闪光灯等照明设备,而不是连续操作它。

使用频闪模式具有以下优点:

  • 它可以帮助延长光源的预期寿命。通过仅在需要时打开光源,LED 中产生的热量更少。这减慢了光源的老化过程。
  • 在频闪模式下,您可以使光源过载,也就是说,将提供的电流最大增加到 500%(对于光源控制器),从而增加光源的亮度。

要启用选通模式,请选择一个 Light Control 设备并设置 BslLightDeviceOperationMode 将参数设置为 Strobe.

配置触发信号和频闪持续时间#

一般来说,触发光源设备的工作原理如下:

  • 最初,光源已关闭。
  • 光源由触发信号打开。
  • 光源保持打开一段时间,即频闪持续时间。
  • 频闪持续时间结束后,光源将再次关闭。
ace 2、boost R 和 dart M 相机#

本节适用于运行不包含 Peripheral Devices Control 功能的固件的 ace 2、boost R 和 dart M 相机。对于出厂时搭载包含 Peripheral Devices Control 功能的固件的 ace 2、boost R 和 dart M 相机,请参阅 Peripheral Devices Control 下的 Light Control 主题。

若要在 ace 2、boost R 和 dart M 相机上配置触发信号和选通脉冲持续时间:

  1. 设置 BslLightControlTriggerSource 参数设置为您要用来开启所连接光源的源,例如 FlashWindow.
  2. 如果适用,请设置 BslLightControlTriggerActivation 参数设置为以下值:
    • RisingEdge (默认):当信号为 上升时,即信号状态从低电平变为高电平,触发器变为激活状态。
    • FallingEdge时,所有连接的光源均会开启:当信号为 下降时,即信号状态从高电平变为低电平。
    • AnyEdge时,所有连接的光源均会开启:当信号为 下降或上升.
  3. 设置 BslLightDeviceStrobeMode 参数设置为以下值:
    • Automatic:选通持续时间由相机的闪光窗口持续时间(BslFlashWindowDuration 参数)控制。此时 BslLightDeviceStrobeDuration 参数变为只读,并显示计算出的选通持续时间。
    • Manual:您可以使用以下方式自行定义频闪持续时间: BslLightDeviceStrobeDuration 参数。
  4. 如果您选择了 Manual 频闪模式,请将 BslLightDeviceStrobeDuration 参数设置为所需的频闪持续时间(以微秒为单位)。

信息

  • 如果您使用的是触发宽度 Exposure Mode 或 Exposure Auto Auto Functions,请勿使用自动频闪模式。否则,相机和光源可能会表现出不可预测的行为。
  • 如果您使用的是 Sequencer 功能,则自动频闪模式不可用。
  • 在自动频闪模式下,计算出的频闪持续时间可能比闪烁窗口持续时间短。这样做是为了补偿光源打开所需的时间,即打开延迟。
  • 如果您在达到相机性能上限时操作相机,则可能会出现过度触发。
ace U/L 相机#

要配置 ace U/L 相机上的触发信号和频闪持续时间:

  1. 如果您使用的是 滚动快门 相机,设置 BslLightControlTriggerMode 参数设置为以下值:

    • ExposureActive:所有连接的光源都会在曝光开始时点亮。仅当您没有进行 重叠 图像采集时,才使用此模式。
    • FlashWindow:当相机的 闪烁窗口 信号上升时,所有连接的光源都会点亮。如果您使用此模式,请确保您的相机型号支持 Flash Window 信号。

    在全局快门相机上,曝光开始时所有连接的光源总是会打开。

  2. 设置 BslLightDeviceStrobeMode 参数设置为以下值:

    • Automatic:选通脉冲持续时间由相机的 ExposureTime 参数控制。
    • Manual:您可以使用以下方式自行定义频闪持续时间: BslLightDeviceStrobeDuration 参数。
  3. 如果您选择了 Manual 频闪模式,请将 BslLightDeviceStrobeDuration 参数设置为所需的选通脉冲持续时间。

信息

使光源设备过载#

注意 – 过载可能会损坏您的光源。

请仔细阅读本节中的说明,以免损坏连接的光源,并确保光源不会过早老化。

使光源过载意味着您可以增加电流,从而在光源处于频闪模式时提高光源强度。

要使光源设备过载:

  1. 如果您使用的是修订号 05 之前的 Basler Light 或第三方照明设备:

    1. 根据当前的占空比和选通脉冲持续时间,计算设备的允许最大电流。在运行以下固件的 Basler ace 2、boost R 和 dart M 相机上 Peripheral Device Control feature, you can read the BslLightDeviceDutyCycle 用于确定当前占空比的参数。
    2. 设置 BslLightDeviceOverdriveLimit parameter accordingly. For example, if your light can withstand 200 % of its nominal current rating, set the overdrive limit to 200.0.

    如果您使用的是 Basler Camera Light,过载限制会自动计算,并且 BslLightDeviceOverdriveLimit 参数不可用。

  2. 设置 BslLightDeviceBrightness 设置为大于 100.0 的值。

过载时,请考虑以下几个方面,以免损坏您的光源:

  • 如果不确定光源在频闪模式下可以承受的最大电流,请与光源的制造商联系。
  • 由于增加的电流会导致 LED 发热量增大,因此必须在各次频闪脉冲之间留出足够的时间,以保证光源再次冷却。根据经验,脉冲强度越高,两次脉冲之间应留出的时间越长。
  • 考虑曝光时间,因为这会影响脉冲的长度和占空比。

安全功能#

The following safety features are implemented in Basler light devices (for lights before revision 05) to avoid damaging the hardware:

SLP Light Controller 上的安全功能#

大于 2 A 的电流以及较长的 Exposure Time 和高占空比可能会损坏控制器硬件。

为避免出现这种情况,您不能将 Basler SLP Light Controllers 的额定电流(BslLightDeviceMaxCurrent 参数)设为大于 2000 mA。

不过,如果使设备过载,最终电流可能会超过 2 A。

在这种情况下,相机会自动调整某些照明设备设置的最大值。请参阅下表。

输出电流(标称电流 x 亮度 %) 最大频闪持续时间 最大占空比
2 A 以下 - 100 %
2 A to <3 A 5 ms 15 %
3 A to <4 A 5 ms 8 %
4 A to <5 A 5 ms 6 %
5 A to <6 A 5 ms 4 %
6 A to <8 A 1 ms 4 %
8 A to <9 A 1 ms 3 %
9 A to <10 A 1 ms 2 %

GPIO 线路配置#

相机通过相机的一条 GPIO 线路与照明设备通信:

  • 在 ace 2、boost R 和 dart M 相机, that are running with a firmware 无 the Peripheral Devices Control feature, the camera always uses Line 3 进行光源通信。因此,当启用 Light Control 功能时, 线模式 of Line 3 is set to InOut 和 线路连接 设置为 LightControl.
  • 在 ace U/L cameras的宽度时, BslLightControlSource parameter shows which GPIO line the camera uses for light communication.

光源设备 ID#

每个通过 SLP 协议连接的光源设备都有一个光源设备 ID。ID 存储在设备上。

有效的光源设备 ID 为 1、2、3、4 和 7。所有设备随附的 ID 均设置为 7(出厂设置)。

在使用 BslLightControlEnumerateDevices 命令枚举设备时,相机将自动搜索其 ID 设置为 7 的设备,并为其分配 1 到 4 之间下一个可用的 ID。

如果使用多个光源设备,则必须确保它们的 ID 都不同。使用具有相同 ID 的设备会导致通信错误。

提示

防止冲突的最佳方法是依次连接设备,并在连接设备后始终分配一个新的唯一 ID。

  • 示例 1:假设您连接一个新的光源设备并枚举设备。相机将 ID 1 分配给设备。然后,断开该设备的连接,连接下一个光源设备,然后再次枚举设备。相机还会将 ID 1 分配给该设备。
  • 示例 2:假设您连接两个新的光源设备并枚举设备。相机找到两个 ID 设置为 7 的设备,并将下一个可用 ID 分配给每个设备,即 1。

在这两个示例中,当您将两个照明设备连接到相机时,都会发生通信错误。您必须更改其中一个 ID 才能解决冲突。

更改光源设备 ID#

要更改光源的 ID:

  1. 设置 BslLightControlMode 将参数设置为 On.
  2. 设置 BslLightDeviceOperationMode 将参数设置为 Off.
  3. 设置 BslLightDeviceSelector 参数设置为要更改其 ID 的 Basler 光源设备。
  4. 设置 BslLightDeviceChangeID 参数设置为所需的 ID,例如 Device1.
    在 ace U/L cameras, the ID is changed immediately.
  5. 在 ace 2、boost R 和 dart M 相机, that are running with a firmware 无 the Peripheral Devices Control feature, execute the BslLightDeviceNewIDSave 命令。

Light Control 功能使用注意事项#

  • 当 BslLightControlMode 设置为 On的宽度时, Serial Communication 功能已被禁用。这是因为 Light Control 功能也使用 Serial Communication。
  • 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 秒的延迟。因此,第一幅图像可能会过暗。您可以丢弃此图像,或者如果您需要所有图像,请在适当的延迟后开始图像采集。
  • 如果使 Basler Camera Light 过载,请不要以超过每秒 60 帧的速度操作相机。否则,相机和光源设备可能会表现出不可预测的行为。
  • Basler ace 2, boost R, and dart M cameras, that are running with a firmware 无 the Peripheral Devices Control feature:
    When loading the light device settings from a User Set加载光源设备设置时,这些设置仅在执行 BslLightControlEnumerateDevices 命令。

过度触发#

如果您在达到相机性能上限时操作相机,则可能会发生光源设备的过度触发。过度触发表示光源设备接收到未准备好接收的触发,例如,因为其仍处在关闭光源的过程中。这意味着触发将被忽略且该光源在下次曝光时不会亮起。

为了更好地理解此问题,请参考以下示例。

具有 100 fps 速度的相机在 Exposure Time 设置为 50 ms 的情况下运行。因此,相机可以每秒 20 帧进行快速连续采集,而曝光之间不会暂停。这意味着必须正好在两次曝光之间的边沿触发光源设备。

实际上,这几乎是无法实现的,因为固有抖动会造成以下情况:有时在触发信号达到时,光源仍关闭。在这种情况下,触发将被忽略且生成的图像太暗。

由于抖动是不规则的,没有精确的方法可防止此情况的发生。如果您注意到其中一些图像比其他的要暗,请考虑以连续模式操作光源。您还可以尝试使用 Acquisition Frame Rate 功能调整帧速率。

监控过度触发#

在 ace 2、boost R 和 dart M 相机, running with a firmware 无 the Peripheral Devices Control feature, the BslLightControlOvertriggerCount 参数可用。它允许您监控在至少有一个连接的照明设备尚未准备好时发送了多少个触发信号。

示例: 假设有 4 个照明设备连接到您的相机。当其中 3 个设备尚未准备好时,您发送了一个触发信号。因此, BslLightControlOvertriggerCount parameter increases by 1. The parameter counts up to a maximum value of 65 535. Then, it stops counting. To reset the overtrigger counter, execute the BslLightControlOvertriggerCountReset 命令。

检查和清除错误#

ace 2、boost R 和 dart M 相机#

Basler ace 2, boost R, and dart M cameras running with a firmware without the Peripheral Devices Control feature, can read the following error data from connected light devices:

  • 错误状态可以帮助您自行更正错误。
  • 错误代码提供了有关错误类型的附加信息,且可以由 Basler 支持人员进行评估。

要检查并清除错误:

  1. 如果您连接了多个设备:
    1. 检查 BslLightControlErrorSummary 参数以找出哪个设备遇到了问题,例如: Device2.
    2. 设置 BslLightDeviceSelector 参数发送给遇到问题的设备。
  2. 获取同一相机上 BslLightDeviceErrorStatus 参数并在下表中查找其含义。 错误状态 下表。
  3. 如果错误状态为“硬件错误”:
    1. 执行 BslLightDeviceErrorStatusReadAndClear 命令。
    2. 获取同一相机上 BslLightDeviceErrorCode 参数并在下表中查找其含义。 Error Codes 下表。
    3. 如果可能的话,请更正错误。
  4. 如果错误状态不是 "Hardware Error":
    1. 如果可能的话,请更正错误。
    2. 执行 BslLightDeviceErrorStatusReadAndClear 命令以将错误状态重置为 NoError.
错误状态#

即: BslLightDeviceErrorStatus 参数可以取以下值:

值 含义
通信故障 如果光源设备和相机之间的数据传输错误,则会发生通信错误。原因可能是使用了过长的线缆或线路上的噪音过大。
连接丢失 与先前连接的光源设备的连接已丢失。例如,如果电缆松动,就会发生这种情况。
硬件错误 照明设备遇到了技术故障。有关硬件错误类型的更多信息,请执行 BslLightDeviceErrorStatusReadAndClear 命令以检索 Error Codes.a
光源设备错误 光源设备遇到内部错误。a
无错误 未检测到错误。
未连接 照明设备未连接到相机或尚未被枚举。执行 BslLightControlEnumerateDevices 命令以枚举该设备。
不支持的设备版本 该光源设备与当前相机不兼容。请联系支持人员以了解固件更新是否可用。
Error Codes#

即: BslLightDeviceErrorCode 参数可以取以下值:

值 含义
0x30024 光源控制器的照明连接器存在短路。这可能是由于光源设备故障造成的。
0x3002A Light Controller 无法提供请求的电流。请尝试调低 BslLightDeviceCurrent parameter value。
(其他) 请联系 Basler 支持人员并提供该错误代码。

ace U/L 相机#

Basler ace U/L 相机可以从连接的光源设备读取错误列表。

最多可以存储 25 个错误。如果发生第 26 个错误,则最早的错误将被覆盖,依此类推。

检查和清除错误是一个反复迭代过程,具体取决于发生了多少个错误。

要检查并清除错误:

  1. 如果您连接了多个设备:
    1. 检查 BslLightControlErrorStatus 参数以找出哪个设备遇到了问题,例如: Device2.
    2. 设置 BslLightDeviceSelector 参数发送给遇到问题的设备。
  2. 获取同一相机上 BslLightDeviceLastError parameter and look up its meaning in the table below.
  3. 更正相应的错误。
  4. To delete the last error from the list of errors, execute the BslLightDeviceClearLastError 命令。
  5. Continue getting and deleting the last error until the BslLightDeviceLastError parameter shows NoError.
值 含义
通信故障 如果光源设备和相机之间的数据传输错误,则会发生通信错误。原因可能是使用了过长的线缆或线路上的噪音过大。
连接错误 如果光源设备和相机之间的连接断开或发生了通信错误,则会发生连接错误。其他原因还可能包括连接松动或控制器完全断开。
硬件错误 光源设备出现技术故障。a
电流不足 Light Controller 无法提供请求的电流。请尝试调低 LightDeviceMaxCurrent parameter value。
无错误 自上次清除错误内存以来,光源设备未检测到任何错误。
短路 光源控制器的照明连接器存在短路。这可能是由于光源设备故障造成的。

  1. 断开并重新连接电源可以解决此问题。为确保重启,需要将控制器断开电源五分钟。这是正常现象。如果您使用多个控制器,即使其他控制器没有遇到任何故障,也必须重启其他控制器的电源。

示例代码#

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"