跳转到内容

Sequencer (ace Classic/U/L GigE)#

相机功能 Sequencer 允许您定义参数设置集,并将其应用于图像采集序列。

您可以定义多达 64 组参数设置(称为序列集)。相机采集图像时,会逐个应用序列集。这使您可以快速更改相机参数,而不会影响最大帧速率。

例如,您可以使用 Sequencer 功能,在预配置的图像 ROI曝光时间之间快速切换。

该功能的使用#

启用或禁用 Sequencer#

启用时,定序器将控制图像采集。无法在此状态下配置定序器。

禁用时,可以配置定序器,但定序器不控制图像采集。

要启用定序器:

  1. 将所有自动功能(例如,Gain AutoExposure Auto)设置为 Off
  2. SequenceEnable 参数设置为 true

禁用定序器:

  1. SequenceEnable 参数设置为 false
  2. 如果您的相机型号上有 SequenceConfigurationMode 参数,请将其设置为 On

序列集中包含什么?#

定序器集包含以下参数(如果可用):

  • AcquisitionFrameRate
  • AcquisitionFrameRateEnable
  • BalanceRatio
  • BinningHorizontal
  • BinningVertical
  • BlackLevel
  • CenterX
  • CenterY
  • ChunkEnable
  • ChunkModeActive
  • ColorAdjustmentEnable
  • ColorAdjustmentHue
  • ColorAdjustmentSaturation
  • ColorTransformationMatrixFactor
  • ColorTransformationValue
  • DecimationVertical
  • DigitalShift
  • ExposureTime
  • Gain
  • Height
  • LUTEnable
  • OffsetX
  • OffsetX
  • PixelFormata
  • ProcessedRawEnable
  • ReverseX
  • ReverseYb
  • ScalingHorizontal
  • SequenceSetExecutionsc
  • StackedZoneImagingEnable
  • StackedZoneImagingZoneEnable
  • StackedZoneImagingZoneHeight
  • StackedZoneImagingZoneOffsetY
  • SubsamplingHorizontal
  • SyncUserOutput
  • TestImageSelector
  • TimerDelayd
  • TimerDelayTimebased
  • TimerDurationd
  • TimerDurationTimebased
  • Width

  1. 仅适用于以下相机型号:acA640-300gm/gc、acA800-200gm/gc、acA1300-75gm/gc、acA1920-48gm/gc、acA2500-20gm/gc。

  2. 不适用于以下相机型号:acA3088-16gm/gc、acA4024-8gm/gc、acA5472-5gm/gc。

  3. 仅在启用自动序列推进模式时包含。

  4. 可用于计时器 1。

其他所有相机参数均无法使用 Sequencer 功能控制。

信息

加载保存序列集将始终加载或保存以上所有参数,包括您未更改的参数在内。例如,如果仅更改 Exposure Time 并保留所有其他参数的默认值,则所有其他参数的值也将被存储,并在加载时被覆盖

配置序列集#

信息

  • 要配置序列集,必须禁用定序器。
  • 断开相机电源后,对序列集所做的所有更改都会丢失。另外,定序器集也无法保存在用户设置集中。为了保留您的设置,Basler 建议您使用 pylon API 编写适当的代码,在每次打开相机电源时重新填充序列集。

在使用 Sequencer 功能之前,必须使用所需的设置填充序列集。每个序列集都有一个唯一的序列集索引编号,范围从 0 到 63。

要填充序列集:

  1. SequenceSetTotalNumber 参数设置为要使用的序列集的总数。
  2. 配置要存储在序列集 0 中的序列集参数
  3. 保存序列集 0。
  4. 对要使用的所有序列集重复步骤 2 和 3。确保始终使用从索引号 0 开始的连续索引号序列,例如,使用序列集 0、1、2 和 3。

示例:假设您需要两个序列集,并希望使用不同的图像 ROI 设置来填充它们。为此:

  1. SequenceSetTotalNumber 参数设置为 2。
  2. 通过调整宽度高度OffsetXOffsetY参数值创建第一个图像 ROI。
  3. 保存序列集 0。
  4. 通过选择不同的宽度高度OffsetXOffsetY参数值创建第二个图像 ROI。
  5. 保存序列集 1。

现在,您可以将定序器配置为在两个图像 ROI 之间快速切换。

保存序列集#

要保存序列集:

  1. SequenceSetIndex 参数设置为所需的序列集。
  2. 执行 SequenceSetStore 命令。

所有序列集参数的值都存储在所选序列集中。

加载序列集#

序列集在定序器运行期间自动加载。但是,手动加载序列集对于测试或在配置定序器时可能很有用。

若要手动加载序列集:

  1. SequenceSetIndex 参数设置为所需的序列集。
  2. 执行 SequenceSetLoad 命令。

所有序列集参数的值都将被覆盖,并由存储在所选序列集中的值替换。

配置 Sequencer#

配置序列集后,必须配置定序器。

信息

  • 要配置定序器,必须禁用定序器。
  • 断开相机电源后,对定序器配置所做的所有更改都将丢失。另外,定序器集也无法保存在用户设置集中。Basler 建议您使用 pylon API 编写适当的程序代码,在相机每次开启电源时重新配置相机。
  • 您可以使用 SequenceSetIndex 块来跟踪所使用的序列集。启用后,每个图像都包含块数据,该数据包括用于图像采集的序列集的索引号。

定序器可以三种模式运行,称为“推进模式”:

在所有模式下,序列集始终从序列集索引号 0 开始,以升序排列。

自动序列推进模式#

如果您希望配置连续重复的固定序列,此模式十分有用。

您可以通过将 SequenceAdvanceMode 参数设置为 Auto 来启用此模式。

在此模式下,当接收到帧开始触发信号时,会自动从一个序列集推进到下一个序列。

SequenceSetTotalNumber 参数指定要使用的序列集的总数。使用具有最高索引号的序列集后,循环再次从 0 开始。

示例:假设您要配置以下序列循环:

示例序列循环:0-1-2-3-4-0-1-...

要配置上述序列循环:

  1. SequenceAdvanceMode 参数设置为 Auto
  2. SequenceSetTotalNumber 参数设置为 5。

多次使用序列集

(可选)每个序列集都可以连续使用多次。

要指定每个序列集要使用多少次:

  1. 加载所需的序列集。
  2. 为此序列集配置 SequenceSetExecutions 参数。默认情况下,所有组的参数均设置为 1,这意味着每个序列集在每个循环内使用一次。
  3. 保存序列集。

示例:假设您要配置以下序列循环:

示例序列循环:0-1-1-1-2-3-4-5-5-0-1-...

要配置上述序列循环:

  1. SequenceAdvanceMode 参数设置为 Auto
  2. SequenceSetTotalNumber 参数设置为 6。
  3. 为每个序列集配置 SequenceSetExecutions 参数:

    • 序列集 0、2、3 和 4 在每个循环中只能使用一次。因此,您可以跳过这些设置,并保留 SequenceSetExecutions 参数的默认值 1。
    • 序列集 1 将连续使用 3 次。加载序列集 1,将 SequenceSetExecutions 参数设置为 3,然后保存序列集 1。
    • 序列集 5 将连续使用两次。加载序列集 5,将 SequenceSetExecutions 参数设置为 2,并保存序列集 5。

受控序列推进模式#

如果您希望配置可以通过Line 1 或软件命令控制的动态序列,此模式非常有用。

信息

  • 对于实时应用,Basler 强烈建议不要通过软件命令来控制定序器。发送软件命令与命令生效之间的延迟时间取决于特定的安装和网络上的当前负载。因此,无法预测在发送软件命令到该命令生效之间可能会发生多少次图像采集。
  • 使用Line 1 控制定序器时,务必牢记,在设置线路状态与帧开始触发信号上升之间需要 1 微秒的时间间隔。在帧开始触发信号上升后,还必须使线路状态保持至少 1 微秒。监视帧触发等待信号以优化时间安排。

可以通过将 SequenceAdvanceMode 参数设置为 Controlled 来启用此模式。

与其他模式一样,推进始终从序列集索引编号 0 开始,按照升序进行。

但是,您可以控制以下内容:

  • 序列集推进:您希望定序器何时推进到下一个序列集?
  • 序列集重新启动:您希望序列循环何时从序列集 0 重新开始?

SequenceSetTotalNumber 参数指定您要使用的序列集的总数。使用具有最高索引号的序列集后,循环再次从 0 开始。

配置序列集推进#

若要配置序列集推进:

  1. SequenceControlSelector 参数设置为 Advance
  2. 设置 SequenceControlSource 参数设置为以下选项:
    • Line1:将通过Line 1 控制序列集推进。如果在接收到帧开始触发信号的同时,Line 1 为低电平 (0),则定序器不会推进,并且当前序列集将再次用于图像采集。如果在接收到帧开始触发信号的同时,Line 1 为高电平 (1),则定序器将推进,并将循环中设置的下一个序列用于图像采集。
    • Disabled:将使用 SequenceAsyncAdvance 软件命令来控制序列集推进。收到此命令后,定序器将推进而不采集图像。当接收到下一个帧开始触发信号时,由 SequenceCurrentSet 参数值指示的序列集将用于图像采集。
    • AlwaysActive:定序器的行为与选择 Line1 且 Line 1 始终为高电平 (1) 时相同。因此,每次接收到帧开始触发信号时,定序器就会推进。当每个序列集在每次循环中仅使用一次时,这种操作定序器的方式类似于在自动定序推进模式下进行操作。唯一的区别是,序列集 1 用作第一个序列集,而不是序列集 0 用作第一个。
配置序列集重启#

若要配置序列集重启:

  1. SequenceControlSelector 参数设置为 Restart
  2. 设置 SequenceControlSource 参数设置为以下选项:
    • Line1:将通过Line 1 控制序列集重启。如果在接收到帧开始触发信号时,Line 1 为低电平 (0),则使用下一个序列集。如果在接收到帧开始触发信号时,Line 1 为高电平 (1),则重新启动序列循环并使用序列集 0。
    • Disabled:将使用 SequenceAsyncRestart 软件命令来控制序列集重启。收到此命令后,序列循环将重新启动而不采集图像。接收到下一个帧开始触发信号时,将使用序列集 0。

自由选择推进模式#

如果您希望在可自由选择的序列集之间快速切换,而无需遵守任何特定顺序,此模式十分有用。您使用相机的输入线路来决定序列。

信息

切记,在设置线路状态与帧开始触发信号上升之间需要 1 微秒的时间间隔。在帧开始触发信号上升后,您还必须使线路状态保持至少 1 微秒。监视帧触发等待信号以优化时间安排。

如何配置自由选择推进模式取决于相机上有多少输入线路可用:

具有一条输入线路的相机#

根据输入Line 1 的状态选择序列集:

  • 如果在接收到帧开始触发信号时Line 1 为低电平 (0),则将序列集 0 用于图像采集。
  • 如果在接收到帧开始触发信号时Line 1 为高电平 (1),则将序列集 1 用于图像采集。

仅序列集 0 和 1 可用。

要启用自由选择推进模式:

  1. SequenceAdvanceMode 参数设置为 FreeSelection
  2. SequenceSetTotalNumber 参数设置为 2。

SequenceAddressBitSelectorSequenceAddressBitSource 参数还控制自由选择推进模式的操作。但是,这些参数是预设的,无法更改。

具有两条输入线路的相机#

根据Line 1(光电耦合输入线路)和Line 3(GPIO 线路,必须配置为输入)的状态选择序列集,从而产生四种可能的组合。这使您可以在四个序列集之间进行选择。因此,只有序列集 0、1、2 和 3 可用。

为了配置自由选择推进模式,必须为每个线路分配一个“序列集地址位”。这些地址位的组合确定序列集索引号。下表显示了可能的组合及其各自的结果。

地址位 1 地址位 0 将要选择的序列集
0 0 序列集 0
0 1 序列集 1
1 0 序列集 2
1 1 序列集 3

例如,您可以将Line 1 分配给位 1,将Line 3 分配给位 0。这将得到以下示例配置:

  • 如果在接收到帧开始触发信号时,Line 1 为低电平 (0),Line 3 为低电平 (0),则将序列集 0 用于图像采集。
  • 如果在接收到帧开始触发信号时,Line 1 为低电平 (0),Line 3 为高电平 (1),则将序列集 1 用于图像采集。
  • 如果在接收到帧开始触发信号时,Line 1 为高电平 (1),Line 3 为低电平 (0),则将序列集 2 用于图像采集。
  • 如果在接收到帧开始触发信号时,Line 1 为高电平 (1),Line 3 为高电平 (1),则将序列集 3 用于图像采集。

要配置位并启用自由选择推进模式:

  1. SequenceAdvanceMode 参数设置为 FreeSelection
  2. SequenceSetTotalNumber 参数设置为 4。
  3. SequenceAddressBitSelector 参数设置为 Bit0
  4. SequenceAddressBitSource 参数设置为要分配给位 0 的线路,例如 Line3
  5. SequenceAddressBitSelector 参数设置为 Bit1
  6. SequenceAddressBitSource 参数设置为要分配给位 1 的线路,例如 Line1

信息

在自由选择推进模式下,您也只能使用一条输入线路。为此,将 SequenceSetTotalNumber 参数设置为 2。现在,仅位 0 用于选择序列集。自由选择推进模式的行为如“具有一条输入线路的相机”中所述。

时序图#

示例:自动序列推进模式#

自动序列推进模式时序图(示例)

示例:受控序列推进模式(通过Line 1 控制)#

受控序列推进模式时序图(示例)

示例:自由选择推进模式#

自由选择推进模式时序图(示例)

示例代码#

// ** Configuring sequence sets **
// Disable the sequencer during configuration
camera.SequenceEnable.SetValue(false);
// Enable configuration mode (available on selected cameras only)
camera.SequenceConfigurationMode.SetValue(SequenceConfigurationMode_On);
// Set the total number of sequence sets to 2
camera.SequenceSetTotalNumber.SetValue(2);
// Configure the parameters that you want to store in the first sequence set
camera.Width.SetValue(500);
camera.Height.SetValue(300);
// Select sequence set 0 and save the parameter values
camera.SequenceSetIndex.SetValue(0);
camera.SequenceSetStore.Execute();
// Configure the parameters that you want to store in the second sequence set
camera.Width.SetValue(800);
camera.Height.SetValue(600);
// Select sequence set 1 and save the parameter values
camera.SequenceSetIndex.SetValue(1);
camera.SequenceSetStore.Execute();
// ** Configuring the sequencer for auto sequence advance mode
// Assuming you want to configure the following sequence cycle:
// 0 - 0 - 1 - 1 - 1 (- 0 - 0 - ...) **
// Disable the sequencer during configuration
camera.SequenceEnable.SetValue(false);
camera.SequenceAdvanceMode.SetValue(SequenceAdvanceMode_Auto);
// Set the total number of sequence sets to 2
camera.SequenceSetTotalNumber.SetValue(2);
// Load sequence set 0 and specify that this set is to be used
// 2 times in a row
camera.SequenceSetIndex.SetValue(0);
camera.SequenceSetLoad.Execute();
camera.SequenceSetExecutions.SetValue(2);
camera.SequenceSetStore.Execute();
// Load sequence set 1 and specify that this set is to be used
// 3 times in a row
camera.SequenceSetIndex.SetValue(1);
camera.SequenceSetLoad.Execute();
camera.SequenceSetExecutions.SetValue(3);
camera.SequenceSetStore.Execute();
// Enable the sequencer
camera.SequenceEnable.SetValue(true);
// ** Configuring the sequencer for controlled sequence advance mode **
// Disable the sequencer during configuration
camera.SequenceEnable.SetValue(false);
camera.SequenceAdvanceMode.SetValue(SequenceAdvanceMode_Controlled);
// Set the total number of sequence sets to 2
camera.SequenceSetTotalNumber.SetValue(2);
// Specify that sequence set advance is controlled via line 1
camera.SequenceControlSelector.SetValue(SequenceControlSelector_Advance);
camera.SequenceControlSource.SetValue(SequenceControlSource_Line1);
// Specify that sequence set restart is controlled
// via software command
camera.SequenceControlSelector.SetValue(SequenceControlSelector_Restart);
camera.SequenceControlSource.SetValue(SequenceControlSource_Disabled);
// Enable the sequencer
camera.SequenceEnable.SetValue(true);
// Restart the sequencer via software command (for testing purposes)
camera.SequenceAsyncRestart.Execute();
// ** Configuring the sequencer for free selection advance mode
// on cameras with ONE input line **
// Disable the sequencer during configuration
camera.SequenceEnable.SetValue(false);
camera.SequenceAdvanceMode.SetValue(SequenceAdvanceMode_FreeSelection);
// Set the total number of sequence sets to 2
camera.SequenceSetTotalNumber.SetValue(2);
// Enable the sequencer
camera.SequenceEnable.SetValue(true);
// ** Configuring the sequencer for free selection advance mode
// on cameras with TWO input lines (1x opto-coupled, 1x GPIO set for input) **
// Disable the sequencer during configuration
camera.SequenceEnable.SetValue(false);
camera.SequenceAdvanceMode.SetValue(SequenceAdvanceMode_FreeSelection);
// Set the total number of sequence sets to 2
camera.SequenceSetTotalNumber.SetValue(4);
// Assign sequence address bit 0 to line 3
camera.SequenceAddressBitSelector.SetValue(SequenceAddressBitSelector_Bit0);
camera.SequenceAddressBitSource.SetValue(SequenceAddressBitSource_Line3);
// Assign sequence address bit 1 to line 1
camera.SequenceAddressBitSelector.SetValue(SequenceAddressBitSelector_Bit1);
camera.SequenceAddressBitSource.SetValue(SequenceAddressBitSource_Line1);
// Enable the sequencer
camera.SequenceEnable.SetValue(true);
INodeMap& nodemap = camera.GetNodeMap();
// ** Configuring sequence sets **
// Disable the sequencer during configuration
CBooleanParameter(nodemap, "SequenceEnable").SetValue(false);
// Enable configuration mode (available on selected cameras only)
CEnumParameter(nodemap, "SequenceConfigurationMode").SetValue("On");
// Set the total number of sequence sets to 2
CIntegerParameter(nodemap, "SequenceSetTotalNumber").SetValue(2);
// Configure the parameters that you want to store in the first sequence set
CIntegerParameter(nodemap, "Width").SetValue(500);
CIntegerParameter(nodemap, "Height").SetValue(300);
// Select sequence set 0 and save the parameter values
CIntegerParameter(nodemap, "SequenceSetIndex").SetValue(0);
CCommandParameter(nodemap, "SequenceSetStore").Execute();
// Configure the parameters that you want to store in the second sequence set
CIntegerParameter(nodemap, "Width").SetValue(800);
CIntegerParameter(nodemap, "Height").SetValue(600);
// Select sequence set 1 and save the parameter values
CIntegerParameter(nodemap, "SequenceSetIndex").SetValue(1);
CCommandParameter(nodemap, "SequenceSetStore").Execute();
// ** Configuring the sequencer for auto sequence advance mode
// Assuming you want to configure the following sequence cycle:
// 0 - 0 - 1 - 1 - 1 (- 0 - 0 - ...) **
// Disable the sequencer during configuration
CBooleanParameter(nodemap, "SequenceEnable").SetValue(false);
CEnumParameter(nodemap, "SequenceAdvanceMode").SetValue("Auto");
// Set the total number of sequence sets to 2
CIntegerParameter(nodemap, "SequenceSetTotalNumber").SetValue(2);
// Load sequence set 0 and specify that this set is to be used
// 2 times in a row
CIntegerParameter(nodemap, "SequenceSetIndex").SetValue(0);
CCommandParameter(nodemap, "SequenceSetLoad").Execute();
CIntegerParameter(nodemap, "SequenceSetExecutions").SetValue(2);
CCommandParameter(nodemap, "SequenceSetStore").Execute();
// Load sequence set 1 and specify that this set is to be used
// 3 times in a row
CIntegerParameter(nodemap, "SequenceSetIndex").SetValue(1);
CCommandParameter(nodemap, "SequenceSetLoad").Execute();
CIntegerParameter(nodemap, "SequenceSetExecutions").SetValue(3);
CCommandParameter(nodemap, "SequenceSetStore").Execute();
// Enable the sequencer
CBooleanParameter(nodemap, "SequenceEnable").SetValue(true);
// ** Configuring the sequencer for controlled sequence advance mode **
// Disable the sequencer during configuration
CBooleanParameter(nodemap, "SequenceEnable").SetValue(false);
CEnumParameter(nodemap, "SequenceAdvanceMode").SetValue("Controlled");
// Set the total number of sequence sets to 2
CIntegerParameter(nodemap, "SequenceSetTotalNumber").SetValue(2);
// Specify that sequence set advance is controlled via line 1
CEnumParameter(nodemap, "SequenceControlSelector").SetValue("Advance");
CEnumParameter(nodemap, "SequenceControlSource").SetValue("Line1");
// Specify that sequence set restart is controlled
// via software command
CEnumParameter(nodemap, "SequenceControlSelector").SetValue("Restart");
CEnumParameter(nodemap, "SequenceControlSource").SetValue("Disabled");
// Enable the sequencer
CBooleanParameter(nodemap, "SequenceEnable").SetValue(true);
// Restart the sequencer via software command (for testing purposes)
CCommandParameter(nodemap, "SequenceAsyncRestart").Execute();
// ** Configuring the sequencer for free selection advance mode
// on cameras with ONE input line **
// Disable the sequencer during configuration
CBooleanParameter(nodemap, "SequenceEnable").SetValue(false);
CEnumParameter(nodemap, "SequenceAdvanceMode").SetValue("FreeSelection");
// Set the total number of sequence sets to 2
CIntegerParameter(nodemap, "SequenceSetTotalNumber").SetValue(2);
// Enable the sequencer
CBooleanParameter(nodemap, "SequenceEnable").SetValue(true);
// ** Configuring the sequencer for free selection advance mode
// on cameras with TWO input lines (1x opto-coupled, 1x GPIO set for input) **
// Disable the sequencer during configuration
CBooleanParameter(nodemap, "SequenceEnable").SetValue(false);
CEnumParameter(nodemap, "SequenceAdvanceMode").SetValue("FreeSelection");
// Set the total number of sequence sets to 2
CIntegerParameter(nodemap, "SequenceSetTotalNumber").SetValue(4);
// Assign sequence address bit 0 to line 3
CEnumParameter(nodemap, "SequenceAddressBitSelector").SetValue("Bit0");
CEnumParameter(nodemap, "SequenceAddressBitSource").SetValue("Line3");
// Assign sequence address bit 1 to line 1
CEnumParameter(nodemap, "SequenceAddressBitSelector").SetValue("Bit1");
CEnumParameter(nodemap, "SequenceAddressBitSource").SetValue("Line1");
// Enable the sequencer
CBooleanParameter(nodemap, "SequenceEnable").SetValue(true);
// ** Configuring sequence sets **
// Disable the sequencer during configuration
camera.Parameters[PLCamera.SequenceEnable].SetValue(false);
// Enable configuration mode (available on selected cameras only)
camera.Parameters[PLCamera.SequenceConfigurationMode].SetValue(PLCamera.SequenceConfigurationMode.On);
// Set the total number of sequence sets to 2
camera.Parameters[PLCamera.SequenceSetTotalNumber].SetValue(2);
// Configure the parameters that you want to store in the first sequence set
camera.Parameters[PLCamera.Width].SetValue(500);
camera.Parameters[PLCamera.Height].SetValue(300);
// Select sequence set 0 and save the parameter values
camera.Parameters[PLCamera.SequenceSetIndex].SetValue(0);
camera.Parameters[PLCamera.SequenceSetStore].Execute();
// Configure the parameters that you want to store in the second sequence set
camera.Parameters[PLCamera.Width].SetValue(800);
camera.Parameters[PLCamera.Height].SetValue(600);
// Select sequence set 1 and save the parameter values
camera.Parameters[PLCamera.SequenceSetIndex].SetValue(1);
camera.Parameters[PLCamera.SequenceSetStore].Execute();
// ** Configuring the sequencer for auto sequence advance mode
// Assuming you want to configure the following sequence cycle:
// 0 - 0 - 1 - 1 - 1 (- 0 - 0 - ...) **
// Disable the sequencer during configuration
camera.Parameters[PLCamera.SequenceEnable].SetValue(false);
camera.Parameters[PLCamera.SequenceAdvanceMode].SetValue(PLCamera.SequenceAdvanceMode.Auto);
// Set the total number of sequence sets to 2
camera.Parameters[PLCamera.SequenceSetTotalNumber].SetValue(2);
// Load sequence set 0 and specify that this set is to be used
// 2 times in a row
camera.Parameters[PLCamera.SequenceSetIndex].SetValue(0);
camera.Parameters[PLCamera.SequenceSetLoad].Execute();
camera.Parameters[PLCamera.SequenceSetExecutions].SetValue(2);
camera.Parameters[PLCamera.SequenceSetStore].Execute();
// Load sequence set 1 and specify that this set is to be used
// 3 times in a row
camera.Parameters[PLCamera.SequenceSetIndex].SetValue(1);
camera.Parameters[PLCamera.SequenceSetLoad].Execute();
camera.Parameters[PLCamera.SequenceSetExecutions].SetValue(3);
camera.Parameters[PLCamera.SequenceSetStore].Execute();
// Enable the sequencer
camera.Parameters[PLCamera.SequenceEnable].SetValue(true);
// ** Configuring the sequencer for controlled sequence advance mode **
// Disable the sequencer during configuration
camera.Parameters[PLCamera.SequenceEnable].SetValue(false);
camera.Parameters[PLCamera.SequenceAdvanceMode].SetValue(PLCamera.SequenceAdvanceMode.Controlled);
// Set the total number of sequence sets to 2
camera.Parameters[PLCamera.SequenceSetTotalNumber].SetValue(2);
// Specify that sequence set advance is controlled via line 1
camera.Parameters[PLCamera.SequenceControlSelector].SetValue(PLCamera.SequenceControlSelector.Advance);
camera.Parameters[PLCamera.SequenceControlSource].SetValue(PLCamera.SequenceControlSource.Line1);
// Specify that sequence set restart is controlled
// via software command
camera.Parameters[PLCamera.SequenceControlSelector].SetValue(PLCamera.SequenceControlSelector.Restart);
camera.Parameters[PLCamera.SequenceControlSource].SetValue(PLCamera.SequenceControlSource.Disabled);
// Enable the sequencer
camera.Parameters[PLCamera.SequenceEnable].SetValue(true);
// Restart the sequencer via software command (for testing purposes)
camera.Parameters[PLCamera.SequenceAsyncRestart].Execute();
// ** Configuring the sequencer for free selection advance mode
// on cameras with ONE input line **
// Disable the sequencer during configuration
camera.Parameters[PLCamera.SequenceEnable].SetValue(false);
camera.Parameters[PLCamera.SequenceAdvanceMode].SetValue(PLCamera.SequenceAdvanceMode.FreeSelection);
// Set the total number of sequence sets to 2
camera.Parameters[PLCamera.SequenceSetTotalNumber].SetValue(2);
// Enable the sequencer
camera.Parameters[PLCamera.SequenceEnable].SetValue(true);
// ** Configuring the sequencer for free selection advance mode
// on cameras with TWO input lines (1x opto-coupled, 1x GPIO set for input) **
// Disable the sequencer during configuration
camera.Parameters[PLCamera.SequenceEnable].SetValue(false);
camera.Parameters[PLCamera.SequenceAdvanceMode].SetValue(PLCamera.SequenceAdvanceMode.FreeSelection);
// Set the total number of sequence sets to 2
camera.Parameters[PLCamera.SequenceSetTotalNumber].SetValue(4);
// Assign sequence address bit 0 to line 3
camera.Parameters[PLCamera.SequenceAddressBitSelector].SetValue(PLCamera.SequenceAddressBitSelector.Bit0);
camera.Parameters[PLCamera.SequenceAddressBitSource].SetValue(PLCamera.SequenceAddressBitSource.Line3);
// Assign sequence address bit 1 to line 1
camera.Parameters[PLCamera.SequenceAddressBitSelector].SetValue(PLCamera.SequenceAddressBitSelector.Bit1);
camera.Parameters[PLCamera.SequenceAddressBitSource].SetValue(PLCamera.SequenceAddressBitSource.Line1);
// Enable the sequencer
camera.Parameters[PLCamera.SequenceEnable].SetValue(true);
/* 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 */
/* ** Configuring sequence sets ** */
/* Disable the sequencer during configuration */
errRes = PylonDeviceSetBooleanFeature(hdev, "SequenceEnable", 0);
CHECK(errRes);
/* Enable configuration mode (available on selected cameras only) */
errRes = PylonDeviceFeatureFromString(hdev, "SequenceConfigurationMode", "On");
CHECK(errRes);
/* Set the total number of sequence sets to 2 */
errRes = PylonDeviceSetIntegerFeature(hdev, "SequenceSetTotalNumber", 2);
CHECK(errRes);
/* Configure the parameters that you want to store in the first sequence set */
errRes = PylonDeviceSetIntegerFeature(hdev, "Width", 500);
CHECK(errRes);
errRes = PylonDeviceSetIntegerFeature(hdev, "Height", 300);
CHECK(errRes);
/* Select sequence set 0 and save the parameter values */
errRes = PylonDeviceSetIntegerFeature(hdev, "SequenceSetIndex", 0);
CHECK(errRes);
errRes = PylonDeviceExecuteCommandFeature(hdev, "SequenceSetStore");
CHECK(errRes);
/* Configure the parameters that you want to store in the second sequence set */
errRes = PylonDeviceSetIntegerFeature(hdev, "Width", 800);
CHECK(errRes);
errRes = PylonDeviceSetIntegerFeature(hdev, "Height", 600);
CHECK(errRes);
/* Select sequence set 1 and save the parameter values */
errRes = PylonDeviceSetIntegerFeature(hdev, "SequenceSetIndex", 1);
CHECK(errRes);
errRes = PylonDeviceExecuteCommandFeature(hdev, "SequenceSetStore");
CHECK(errRes);
/* ** Configuring the sequencer for auto sequence advance mode */
/* Assuming you want to configure the following sequence cycle: */
/* 0 - 0 - 1 - 1 - 1 (- 0 - 0 - ...) ** */
/* Disable the sequencer during configuration */
errRes = PylonDeviceSetBooleanFeature(hdev, "SequenceEnable", 0);
CHECK(errRes);
errRes = PylonDeviceFeatureFromString(hdev, "SequenceAdvanceMode", "Auto");
CHECK(errRes);
/* Set the total number of sequence sets to 2 */
errRes = PylonDeviceSetIntegerFeature(hdev, "SequenceSetTotalNumber", 2);
CHECK(errRes);
/* Load sequence set 0 and specify that this set is to be used */
/* 2 times in a row */
errRes = PylonDeviceSetIntegerFeature(hdev, "SequenceSetIndex", 0);
CHECK(errRes);
errRes = PylonDeviceExecuteCommandFeature(hdev, "SequenceSetLoad");
CHECK(errRes);
errRes = PylonDeviceSetIntegerFeature(hdev, "SequenceSetExecutions", 2);
CHECK(errRes);
errRes = PylonDeviceExecuteCommandFeature(hdev, "SequenceSetStore");
CHECK(errRes);
/* Load sequence set 1 and specify that this set is to be used */
/* 3 times in a row */
errRes = PylonDeviceSetIntegerFeature(hdev, "SequenceSetIndex", 1);
CHECK(errRes);
errRes = PylonDeviceExecuteCommandFeature(hdev, "SequenceSetLoad");
CHECK(errRes);
errRes = PylonDeviceSetIntegerFeature(hdev, "SequenceSetExecutions", 3);
CHECK(errRes);
errRes = PylonDeviceExecuteCommandFeature(hdev, "SequenceSetStore");
CHECK(errRes);
/* Enable the sequencer */
errRes = PylonDeviceSetBooleanFeature(hdev, "SequenceEnable", 1);
CHECK(errRes);
/* ** Configuring the sequencer for controlled sequence advance mode ** */
/* Disable the sequencer during configuration */
errRes = PylonDeviceSetBooleanFeature(hdev, "SequenceEnable", 0);
CHECK(errRes);
errRes = PylonDeviceFeatureFromString(hdev, "SequenceAdvanceMode", "Controlled");
CHECK(errRes);
/* Set the total number of sequence sets to 2 */
errRes = PylonDeviceSetIntegerFeature(hdev, "SequenceSetTotalNumber", 2);
CHECK(errRes);
/* Specify that sequence set advance is controlled via line 1 */
errRes = PylonDeviceFeatureFromString(hdev, "SequenceControlSelector", "Advance");
CHECK(errRes);
errRes = PylonDeviceFeatureFromString(hdev, "SequenceControlSource", "Line1");
CHECK(errRes);
/* Specify that sequence set restart is controlled */
/* via software command */
errRes = PylonDeviceFeatureFromString(hdev, "SequenceControlSelector", "Restart");
CHECK(errRes);
errRes = PylonDeviceFeatureFromString(hdev, "SequenceControlSource", "Disabled");
CHECK(errRes);
/* Enable the sequencer */
errRes = PylonDeviceSetBooleanFeature(hdev, "SequenceEnable", 1);
CHECK(errRes);
/* Restart the sequencer via software command (for testing purposes) */
errRes = PylonDeviceExecuteCommandFeature(hdev, "SequenceAsyncRestart");
CHECK(errRes);
/* ** Configuring the sequencer for free selection advance mode */
/* on cameras with ONE input line ** */
/* Disable the sequencer during configuration */
errRes = PylonDeviceSetBooleanFeature(hdev, "SequenceEnable", 0);
CHECK(errRes);
errRes = PylonDeviceFeatureFromString(hdev, "SequenceAdvanceMode", "FreeSelection");
CHECK(errRes);
/* Set the total number of sequence sets to 2 */
errRes = PylonDeviceSetIntegerFeature(hdev, "SequenceSetTotalNumber", 2);
CHECK(errRes);
/* Enable the sequencer */
errRes = PylonDeviceSetBooleanFeature(hdev, "SequenceEnable", 1);
CHECK(errRes);
/* ** Configuring the sequencer for free selection advance mode */
/* on cameras with TWO input lines (1x opto-coupled, 1x GPIO set for input) ** */
/* Disable the sequencer during configuration */
errRes = PylonDeviceSetBooleanFeature(hdev, "SequenceEnable", 0);
CHECK(errRes);
errRes = PylonDeviceFeatureFromString(hdev, "SequenceAdvanceMode", "FreeSelection");
CHECK(errRes);
/* Set the total number of sequence sets to 2 */
errRes = PylonDeviceSetIntegerFeature(hdev, "SequenceSetTotalNumber", 4);
CHECK(errRes);
/* Assign sequence address bit 0 to line 3 */
errRes = PylonDeviceFeatureFromString(hdev, "SequenceAddressBitSelector", "Bit0");
CHECK(errRes);
errRes = PylonDeviceFeatureFromString(hdev, "SequenceAddressBitSource", "Line3");
CHECK(errRes);
/* Assign sequence address bit 1 to line 1 */
errRes = PylonDeviceFeatureFromString(hdev, "SequenceAddressBitSelector", "Bit1");
CHECK(errRes);
errRes = PylonDeviceFeatureFromString(hdev, "SequenceAddressBitSource", "Line1");
CHECK(errRes);
/* Enable the sequencer */
errRes = PylonDeviceSetBooleanFeature(hdev, "SequenceEnable", 1);
CHECK(errRes);
# ** Configuring sequence sets **
# Disable the sequencer during configuration
camera.SequenceEnable.Value = False
# Enable configuration mode (available on selected cameras only)
camera.SequenceConfigurationMode.Value = "On"
# Set the total number of sequence sets to 2
camera.SequenceSetTotalNumber.Value = 2
# Configure the parameters that you want to store in the first sequence set
camera.Width.Value = 500
camera.Height.Value = 300
# Select sequence set 0 and save the parameter values
camera.SequenceSetIndex.Value = 0
camera.SequenceSetStore.Execute()
# Configure the parameters that you want to store in the second sequence set
camera.Width.Value = 800
camera.Height.Value = 600
# Select sequence set 1 and save the parameter values
camera.SequenceSetIndex.Value = 1
camera.SequenceSetStore.Execute()
# ** Configuring the sequencer for auto sequence advance mode
# Assuming you want to configure the following sequence cycle:
# 0 - 0 - 1 - 1 - 1 (- 0 - 0 - ...) **
# Disable the sequencer during configuration
camera.SequenceEnable.Value = False
camera.SequenceAdvanceMode.Value = "Auto"
# Set the total number of sequence sets to 2
camera.SequenceSetTotalNumber.Value = 2
# Load sequence set 0 and specify that this set is to be used
# 2 times in a row
camera.SequenceSetIndex.Value = 0
camera.SequenceSetLoad.Execute()
camera.SequenceSetExecutions.Value = 2
camera.SequenceSetStore.Execute()
# Load sequence set 1 and specify that this set is to be used
# 3 times in a row
camera.SequenceSetIndex.Value = 1
camera.SequenceSetLoad.Execute()
camera.SequenceSetExecutions.Value = 3
camera.SequenceSetStore.Execute()
# Enable the sequencer
camera.SequenceEnable.Value = True
# ** Configuring the sequencer for controlled sequence advance mode **
# Disable the sequencer during configuration
camera.SequenceEnable.Value = False
camera.SequenceAdvanceMode.Value = "Controlled"
# Set the total number of sequence sets to 2
camera.SequenceSetTotalNumber.Value = 2
# Specify that sequence set advance is controlled via line 1
camera.SequenceControlSelector.Value = "Advance"
camera.SequenceControlSource.Value = "Line1"
# Specify that sequence set restart is controlled
# via software command
camera.SequenceControlSelector.Value = "Restart"
camera.SequenceControlSource.Value = "Disabled"
# Enable the sequencer
camera.SequenceEnable.Value = True
# Restart the sequencer via software command (for testing purposes)
camera.SequenceAsyncRestart.Execute()
# ** Configuring the sequencer for free selection advance mode
# on cameras with ONE input line **
# Disable the sequencer during configuration
camera.SequenceEnable.Value = False
camera.SequenceAdvanceMode.Value = "FreeSelection"
# Set the total number of sequence sets to 2
camera.SequenceSetTotalNumber.Value = 2
# Enable the sequencer
camera.SequenceEnable.Value = True
# ** Configuring the sequencer for free selection advance mode
# on cameras with TWO input lines (1x opto-coupled, 1x GPIO set for input) **
# Disable the sequencer during configuration
camera.SequenceEnable.Value = False
camera.SequenceAdvanceMode.Value = "FreeSelection"
# Set the total number of sequence sets to 2
camera.SequenceSetTotalNumber.Value = 4
# Assign sequence address bit 0 to line 3
camera.SequenceAddressBitSelector.Value = "Bit0"
camera.SequenceAddressBitSource.Value = "Line3"
# Assign sequence address bit 1 to line 1
camera.SequenceAddressBitSelector.Value = "Bit1"
camera.SequenceAddressBitSource.Value = "Line1"
# Enable the sequencer
camera.SequenceEnable.Value = True

您也可以使用 pylon Viewer 轻松设置参数。