Skip to content

Sequencer (ace 2 and boost)#

The Sequencer camera feature allows you to define sets of parameter settings and apply them to a sequence of images.

You can define up to 32 sets of parameter settings, called sequencer sets. As the camera receives trigger signals, it applies one sequencer set after the other.

For example, you can use the Sequencer feature to quickly change between preconfigured image ROIs or exposure times.

Using the Feature#

Sequencer Modes#

  • In sequencer configuration mode, you can configure the sequencer but you can't operate it.
  • In sequencer mode, you can operate the sequencer but you can't configure it.

Sequencer Configuration Mode#

To enable the sequencer configuration mode:

  1. Set the SequencerMode parameter to Off.
  2. Set the SequencerConfigurationMode parameter to On.

You can now configure the sequencer.

Info

  • In configuration mode, some camera parameters may not be available, i.e., they are set to read-only. Check the Features - All pane in the pylon Viewer to find out which parameters are available.

Sequencer Mode#

To enable the sequencer mode, set the SequencerMode parameter to On. This automatically disables the sequencer configuration mode.

The sequencer is now ready to receive trigger signals and advance as configured.

Info

  • By default, when enabling the sequencer mode, the camera immediately loads sequencer set 0. To change this behavior, set the SequencerSetStart parameter to the desired start set.
  • In sequencer mode, some camera parameters may not be available, i.e., they are set to read-only. Check the Features - All pane in the pylon Viewer to find out which parameters are available.
  • In sequencer mode, some camera parameter values are calculated based on the sequencer sets configured:
    • The PayloadSize parameter value reflects the size of the largest sequencer set configured.
    • The maximum possible number of images in a burst of images, i.e., the maximum value of the AcquisitionBurstFrameCount parameter, is calculated using the largest sequencer set configured.
  • You can use the SequencerSetActive parameter to find out which sequencer set is currently active.
  • If available, you can use the Sequencer Set Active chunk to keep track of the sequencer sets used. When enabled, each image contains chunk data including the index number of the sequencer set used for image acquisition.

What's in a Sequencer Set?#

Sequencer sets contain the following parameters, if available:

  • AutoFunctionROIWidtha
  • AutoFunctionROIHeighta
  • AutoFunctionROIOffsetXa
  • AutoFunctionROIOffsetYa
  • BinningHorizontalab
  • BinningVerticalab
  • BinningHorizontalModeab
  • BinningVerticalModeab
  • ExposureTimec
  • Gain
  • Heightad
  • OffsetXad
  • OffsetYad
  • PixelFormata
  • SequencerSetNext
  • SequencerTriggerActivation
  • SequencerTriggerSource
  • Widthad

  1. Not available on Basler boost cameras.

  2. Only the settings for FPGA binning are stored.

  3. When operating or configuring the sequencer, the exposure time mode is preset to Standard and can't be changed.

  4. When operating or configuring the sequencer, the Multiple ROI feature is disabled.

All other camera parameters can't be controlled using the Sequencer feature.

Info

Loading or saving a sequencer set will always load or save all of the above parameters, even those you haven't changed. For example, if you only changed the exposure time and left all other parameters at their default values, the values of all other parameters will also be stored – and overwritten on load.

Configuring the Sequencer#

Basler recommends configuring the sequencer in two steps:

  1. Populate the sequencer sets with your desired camera settings (e.g., exposure time or image ROI).
  2. Configure sequencer set advance, i.e., define how and when the sequencer should advance from one set to the next.

Populating the Sequencer Sets#

Each sequencer set has a unique index number, ranging from 0 to 31. You can populate the sets with your desired camera settings (e.g., exposure time or image ROI).

To populate a sequencer set:

  1. Make sure the sequencer is in configuration mode.
  2. Configure the camera parameters that you want to store in a sequencer set.
  3. Set the SequencerSetSelector parameter to the index number of the desired set.
  4. Execute the SequencerSetSave command.
  5. Repeat steps 2 to 4 for all sets you want to use.

Example: Assume you want to populate sets 0 and 1 with different image ROI settings. To do so:

  1. Create the first image ROI by adjusting the Width, Height, OffsetX, and OffsetY parameter values.
  2. Save set 0.
  3. Create the second image ROI by choosing different values for the Width, Height, OffsetX, and OffsetY parameters.
  4. Save set 1.

You can then configure sequencer set advance so that the camera quickly changes between the two image ROIs.

Configuring Sequencer Set Advance#

To control the sequencer, you must define how and when the sequencer should advance from one set to the next.

For each sequencer set, you must define the following:

Criterion Parameter
What should be the next set? SequencerSetNext
On which trigger signal should the sequencer advance to the next set? SequencerTriggerSource
When should the trigger signal be considered valid, e.g., on the rising or falling edge of the signal? SequencerTriggerActivation

If required, you can define the above twice for each set, by configuring so-called paths. For example, you can define that the camera should advance to set 1 when a trigger signal on Line 3 is received (= path 0), but advance to set 3 when a trigger signal on Line 4 is received (= path 1).

When all this is set up, the camera knows exactly when and how to transition between the sequencer sets, essentially behaving like a state machine.

Sequencer Set Advance Is Independent of Frame Triggering

The sequencer can advance independently of image acquisition. Images are always acquired using the set that is the active set at the time the camera receives a frame trigger signal.

For example, you can trigger sequencer set advance using input line 3, but trigger images using line 4.

If you want to synchronize sequencer advance with image acquisition, Basler recommends setting the sequencer trigger source to ExposureStart.

Do not set the sequencer and frame start trigger source to the same signal source. Otherwise, the camera may show unpredictable behavior.

To configure sequencer set advance:

  1. Make sure the sequencer is in configuration mode.
  2. Set the SequencerSetSelector parameter to the first sequencer set to be configured.
  3. Execute the SequencerSetLoad command.
  4. Configure sequencer set advance for path 0:
    1. Set the SequencerPathSelector parameter to 0.
    2. Set the SequencerSetNext parameter to the next set to be configured.
    3. Set the SequencerTriggerSource parameter to the source signal that should be used to advance to the next set.
      You can select any of the available trigger source signals, e.g., Line1 or ExposureStart.
    4. If you selected a trigger source that can be high (1) or low (0), i.e., an I/O signal, set the SequencerTriggerActivation parameter to one of the following values:
      • RisingEdge (default): The sequencer advances when the source signal rises, i.e., when the signal status changes from low to high.
      • FallingEdge: The sequencer advances when the source signal falls, i.e., when the signal status changes from high to low.
      • AnyEdge: The sequencer advances when the source signal falls or rises.
      • LevelHigh: The sequencer advances when the source signal is high. If the signal is already high when the sequencer set is loaded, the sequencer immediately advances to the next set. This happens independently of image acquisition.
      • LevelLow: The sequencer advances when the source signal is low. If the signal is already low when the sequencer set is loaded, the sequencer immediately advances to the next set. This happens independently of image acquisition.
  5. If you want to define a second condition on which you want the camera to advance to a different set, repeat step 4 with the SequencerPathSelector parameter set to 1.
  6. Execute the SequencerSetSave command.
  7. Set the SequencerSetSelector parameter to the next sequencer set to be configured.
  8. Repeat steps 3 to 7 for all desired sets.

Examples#

Example 1: Cycling Through Sets#

Assume you want to cycle through sequencer sets 0, 1, and 2 during image acquisition. Whenever the camera acquires an image, the sequencer should advance to the next set.

Example 1 State Diagram

To achieve this, set up the sequencer as follows:

Sequencer Set Selector Sequencer Path Selector Sequencer Trigger Source Sequencer Trigger Activation Sequencer Set Next
0 0 ExposureStart - 1
1 0 ExposureStart - 2
2 0 ExposureStart - 0

The following outlines what happens if you set up the sequencer as shown above:

  • When enabled, the sequencer starts with set 0 (default) and waits for the exposure of the first image.
  • When that happens, the camera applies the current sequencer set 0 to the image and then advances to set 1.
  • When the next exposure starts, the camera applies set 1 and advances to set 2.
  • When the next exposure starts, the camera applies set 2 and advances to set 0.
  • Now, the sequencer has returned to set 0, and the process described above repeats.

Example 2: Using a Counter and Multiple Paths#

You can set up the sequencer to advance to a specific set on every nth image acquisition.

This involves using the Counter feature and configuring multiple paths.

Assume you want to alternate between sequencer sets 0 and 1 during image acquisition, but for the first and every 10th image, sequencer set 2 should be used.

Example 2 State Diagram

To achieve this:

  1. Set the SequencerStartSet parameter to 2.
  2. Configure counter 1 as follows:
    • CounterDuration = 10
    • CounterEventSource = ExposureStart
    • CounterResetSource = Counter1End
  3. Set up the sequencer as shown in the table below.
Sequencer Set Selector Sequencer Path Selector Sequencer Trigger Source Sequencer Trigger Activation Sequencer Set Next
0 0 ExposureActive FallingEdge 1
0 1 Counter1End - 2
1 0 ExposureActive FallingEdge 0
1 1 Counter1End - 2
2 0 ExposureActive FallingEdge 0

Info

  • Make sure the counter is reset before you start image acquisition. Otherwise, it won't count.
  • In the configuration above, note that the counter is triggered using Exposure Start signals, while sequencer set advance is triggered using Exposure Active signals with falling edge activation. This helps to avoid timing conflicts between path 0 and path 1.

The following outlines what happens if you set up the sequencer as shown above:

  • When enabled, the sequencer starts with set 2 and waits for the exposure of the first image.
  • When the first exposure starts, Counter 1 increases from 0 to 1, because it is configured to count Exposure Start events.
  • When the first exposure ends, i.e., when the Exposure Active signal falls, the sequencer advances to set 0.
  • For the next 8 image acquisitions, the sequencer alternates between sets 0 and 1 and the counter continues to increase. The sequencer advances whenever an exposure ends, i.e., when the Exposure Active signal falls.
  • When the exposure of the 10th image starts, the counter reaches its maximum value (CounterDuration = 10), resets itself, and the camera sends a Counter 1 End signal. This makes the sequencer advance to set 2 on path 1 before the path 0 trigger condition (ExposureActive, FallingEdge) becomes valid.
  • Now, the sequencer has returned to set 2, and the process described above repeats.

Example 3: Selection at Runtime#

You can set up the sequencer to select sequencer sets at runtime as required.

This involves configuring multiple I/O lines as trigger sources and using the LevelLow and LevelHigh options of the SequencerTriggerActivation parameter.

Assume you want to control sequencer set selection using the signal status (0 = low, 1 = high) of input lines 2 and 3. Depending on the lines' statuses, you want the sequencer to operate as follows:

Signal Status Line 2 Signal Status Line 3 Selected Set
0 0 0
0 1 1
1 0 2
1 1 3

To achieve this, set up the sequencer as follows:

Sequencer Set Selector Sequencer Path Selector Sequencer Trigger Source Sequencer Trigger Activation Sequencer Set Next
0 0 Line3 LineHigh 1
0 1 Line2 LineHigh 2
1 0 Line3 LineLow 0
1 1 Line2 LineHigh 3
2 0 Line3 LineHigh 3
2 1 Line2 LineLow 0
3 0 Line3 LineLow 2
3 1 Line2 LineLow 1

The following outlines what happens if you set up the sequencer as shown above:

  • As long as both signals are low, the triggers on Line 2 and Line 3 stay inactive, because their trigger activation is set to LineHigh. See table rows 1 and 2. Therefore, the sequencer remains at set 0.
  • When the signal on Line 3 rises, the LineHigh activation occurs, and the sequencer immediately advances from set 0 to set 1. See table row 1. Then, the sequencer remains at set 1, because Line 2 is still low.
  • When the signal on Line 2 also rises, the sequencer advances from set 1 to set 3. See table row 4.
  • When the signal on Line 2 falls, the sequencer advances back to set 1. See table row 8.
  • When the signal on Line 3 also falls, the sequencer advances back to set 0. See table row 3.

Info

  • This also works if you change the I/O signal on both lines at the same time, e.g., by switching the statuses of both I/O lines from high to low.
  • Image acquisition must be triggered separately. The sequencer may advance multiple times between frames when the I/O line status changes.

Sample Code#

// ** Populating the Sequencer Sets **
// Enable sequencer configuration mode
camera.SequencerMode.SetValue(SequencerMode_Off);
camera.SequencerConfigurationMode.SetValue(SequencerConfigurationMode_On);
// Configure parameters to be stored in the first sequencer set
camera.Width.SetValue(600);
camera.Height.SetValue(300);
// Select sequencer set 0 and save the parameter values
camera.SequencerSetSelector.SetValue(0);
camera.SequencerSetSave.Execute();
// Configure parameters to be stored in the second sequencer set
camera.Width.SetValue(800);
camera.Height.SetValue(600);
// Select sequencer set 1 and save the parameter values
camera.SequencerSetSelector.SetValue(1);
camera.SequencerSetSave.Execute();
// Enable sequencer mode to operate the sequencer
camera.SequencerMode.SetValue(SequencerMode_On);
// ** Configuring sequencer set advance **
// Assume you want to alternate between sequencer sets 0 and 1 using input line 3
// Enable sequencer configuration mode
camera.SequencerMode.SetValue(SequencerMode_Off);
camera.SequencerConfigurationMode.SetValue(SequencerConfigurationMode_On);
// Set the start set to set 0
camera.SequencerSetStart.SetValue(0);
// Load and configure sequencer set 0
camera.SequencerSetSelector.SetValue(0);
camera.SequencerSetLoad.Execute();
camera.SequencerPathSelector.SetValue(0);
camera.SequencerSetNext.SetValue(1);
camera.SequencerTriggerSource.SetValue(SequencerTriggerSource_Line3);
camera.SequencerTriggerActivation.SetValue(SequencerTriggerActivation_RisingEdge);
// Save the changes
camera.SequencerSetSave.Execute();
// Load and configure sequencer set 1
camera.SequencerSetSelector.SetValue(1);
camera.SequencerSetLoad.Execute();
camera.SequencerPathSelector.SetValue(0);
camera.SequencerSetNext.SetValue(2);
camera.SequencerTriggerSource.SetValue(SequencerTriggerSource_Line3);
camera.SequencerTriggerActivation.SetValue(SequencerTriggerActivation_RisingEdge);
// Save the changes
camera.SequencerSetSave.Execute();
// Enable sequencer mode to operate the sequencer
camera.SequencerMode.SetValue(SequencerMode_On);
INodeMap& nodemap = camera.GetNodeMap();
// ** Populating the Sequencer Sets **
// Enable sequencer configuration mode
CEnumParameter(nodemap, "SequencerMode").SetValue("Off");
CEnumParameter(nodemap, "SequencerConfigurationMode").SetValue("On");
// Configure parameters to be stored in the first sequencer set
CIntegerParameter(nodemap, "Width").SetValue(600);
CIntegerParameter(nodemap, "Height").SetValue(300);
// Select sequencer set 0 and save the parameter values
CIntegerParameter(nodemap, "SequencerSetSelector").SetValue(0);
CCommandParameter(nodemap, "SequencerSetSave").Execute();
// Configure parameters to be stored in the second sequencer set
CIntegerParameter(nodemap, "Width").SetValue(800);
CIntegerParameter(nodemap, "Height").SetValue(600);
// Select sequencer set 1 and save the parameter values
CIntegerParameter(nodemap, "SequencerSetSelector").SetValue(1);
CCommandParameter(nodemap, "SequencerSetSave").Execute();
// Enable sequencer mode to operate the sequencer
CEnumParameter(nodemap, "SequencerMode").SetValue("On");
// ** Configuring sequencer set advance **
// Assume you want to alternate between sequencer sets 0 and 1 using input line 3
// Enable sequencer configuration mode
CEnumParameter(nodemap, "SequencerMode").SetValue("Off");
CEnumParameter(nodemap, "SequencerConfigurationMode").SetValue("On");
// Set the start set to set 0
CIntegerParameter(nodemap, "SequencerSetStart").SetValue(0);
// Load and configure sequencer set 0
CIntegerParameter(nodemap, "SequencerSetSelector").SetValue(0);
CCommandParameter(nodemap, "SequencerSetLoad").Execute();
CIntegerParameter(nodemap, "SequencerPathSelector").SetValue(0);
CIntegerParameter(nodemap, "SequencerSetNext").SetValue(1);
CEnumParameter(nodemap, "SequencerTriggerSource").SetValue("Line3");
CEnumParameter(nodemap, "SequencerTriggerActivation").SetValue("RisingEdge");
// Save the changes
CCommandParameter(nodemap, "SequencerSetSave").Execute();
// Load and configure sequencer set 1
CIntegerParameter(nodemap, "SequencerSetSelector").SetValue(1);
CCommandParameter(nodemap, "SequencerSetLoad").Execute();
CIntegerParameter(nodemap, "SequencerPathSelector").SetValue(0);
CIntegerParameter(nodemap, "SequencerSetNext").SetValue(2);
CEnumParameter(nodemap, "SequencerTriggerSource").SetValue("Line3");
CEnumParameter(nodemap, "SequencerTriggerActivation").SetValue("RisingEdge");
// Save the changes
CCommandParameter(nodemap, "SequencerSetSave").Execute();
// Enable sequencer mode to operate the sequencer
CEnumParameter(nodemap, "SequencerMode").SetValue("On");
// ** Populating the Sequencer Sets **
// Enable sequencer configuration mode
camera.Parameters[PLCamera.SequencerMode].SetValue(PLCamera.SequencerMode.Off);
camera.Parameters[PLCamera.SequencerConfigurationMode].SetValue(PLCamera.SequencerConfigurationMode.On);
// Configure parameters to be stored in the first sequencer set
camera.Parameters[PLCamera.Width].SetValue(600);
camera.Parameters[PLCamera.Height].SetValue(300);
// Select sequencer set 0 and save the parameter values
camera.Parameters[PLCamera.SequencerSetSelector].SetValue(0);
camera.Parameters[PLCamera.SequencerSetSave].Execute();
// Configure parameters to be stored in the second sequencer set
camera.Parameters[PLCamera.Width].SetValue(800);
camera.Parameters[PLCamera.Height].SetValue(600);
// Select sequencer set 1 and save the parameter values
camera.Parameters[PLCamera.SequencerSetSelector].SetValue(1);
camera.Parameters[PLCamera.SequencerSetSave].Execute();
// Enable sequencer mode to operate the sequencer
camera.Parameters[PLCamera.SequencerMode].SetValue(PLCamera.SequencerMode.On);
// ** Configuring sequencer set advance **
// Assume you want to alternate between sequencer sets 0 and 1 using input line 3
// Enable sequencer configuration mode
camera.Parameters[PLCamera.SequencerMode].SetValue(PLCamera.SequencerMode.Off);
camera.Parameters[PLCamera.SequencerConfigurationMode].SetValue(PLCamera.SequencerConfigurationMode.On);
// Set the start set to set 0
camera.Parameters[PLCamera.SequencerSetStart].SetValue(0);
// Load and configure sequencer set 0
camera.Parameters[PLCamera.SequencerSetSelector].SetValue(0);
camera.Parameters[PLCamera.SequencerSetLoad].Execute();
camera.Parameters[PLCamera.SequencerPathSelector].SetValue(0);
camera.Parameters[PLCamera.SequencerSetNext].SetValue(1);
camera.Parameters[PLCamera.SequencerTriggerSource].SetValue(PLCamera.SequencerTriggerSource.Line3);
camera.Parameters[PLCamera.SequencerTriggerActivation].SetValue(PLCamera.SequencerTriggerActivation.RisingEdge);
// Save the changes
camera.Parameters[PLCamera.SequencerSetSave].Execute();
// Load and configure sequencer set 1
camera.Parameters[PLCamera.SequencerSetSelector].SetValue(1);
camera.Parameters[PLCamera.SequencerSetLoad].Execute();
camera.Parameters[PLCamera.SequencerPathSelector].SetValue(0);
camera.Parameters[PLCamera.SequencerSetNext].SetValue(2);
camera.Parameters[PLCamera.SequencerTriggerSource].SetValue(PLCamera.SequencerTriggerSource.Line3);
camera.Parameters[PLCamera.SequencerTriggerActivation].SetValue(PLCamera.SequencerTriggerActivation.RisingEdge);
// Save the changes
camera.Parameters[PLCamera.SequencerSetSave].Execute();
// Enable sequencer mode to operate the sequencer
camera.Parameters[PLCamera.SequencerMode].SetValue(PLCamera.SequencerMode.On);
/* 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 */
/* ** Populating the Sequencer Sets ** */
/* Enable sequencer configuration mode */
errRes = PylonDeviceFeatureFromString(hdev, "SequencerMode", "Off");
CHECK(errRes);
errRes = PylonDeviceFeatureFromString(hdev, "SequencerConfigurationMode", "On");
CHECK(errRes);
/* Configure parameters to be stored in the first sequencer set */
errRes = PylonDeviceSetIntegerFeature(hdev, "Width", 600);
CHECK(errRes);
errRes = PylonDeviceSetIntegerFeature(hdev, "Height", 300);
CHECK(errRes);
/* Select sequencer set 0 and save the parameter values */
errRes = PylonDeviceSetIntegerFeature(hdev, "SequencerSetSelector", 0);
CHECK(errRes);
errRes = PylonDeviceExecuteCommandFeature(hdev, "SequencerSetSave");
CHECK(errRes);
/* Configure parameters to be stored in the second sequencer set */
errRes = PylonDeviceSetIntegerFeature(hdev, "Width", 800);
CHECK(errRes);
errRes = PylonDeviceSetIntegerFeature(hdev, "Height", 600);
CHECK(errRes);
/* Select sequencer set 1 and save the parameter values */
errRes = PylonDeviceSetIntegerFeature(hdev, "SequencerSetSelector", 1);
CHECK(errRes);
errRes = PylonDeviceExecuteCommandFeature(hdev, "SequencerSetSave");
CHECK(errRes);
/* Enable sequencer mode to operate the sequencer */
errRes = PylonDeviceFeatureFromString(hdev, "SequencerMode", "On");
CHECK(errRes);
/* ** Configuring sequencer set advance ** */
/* Assume you want to alternate between sequencer sets 0 and 1 using input line 3 */
/* Enable sequencer configuration mode */
errRes = PylonDeviceFeatureFromString(hdev, "SequencerMode", "Off");
CHECK(errRes);
errRes = PylonDeviceFeatureFromString(hdev, "SequencerConfigurationMode", "On");
CHECK(errRes);
/* Set the start set to set 0 */
errRes = PylonDeviceSetIntegerFeature(hdev, "SequencerSetStart", 0);
CHECK(errRes);
/* Load and configure sequencer set 0 */
errRes = PylonDeviceSetIntegerFeature(hdev, "SequencerSetSelector", 0);
CHECK(errRes);
errRes = PylonDeviceExecuteCommandFeature(hdev, "SequencerSetLoad");
CHECK(errRes);
errRes = PylonDeviceSetIntegerFeature(hdev, "SequencerPathSelector", 0);
CHECK(errRes);
errRes = PylonDeviceSetIntegerFeature(hdev, "SequencerSetNext", 1);
CHECK(errRes);
errRes = PylonDeviceFeatureFromString(hdev, "SequencerTriggerSource", "Line3");
CHECK(errRes);
errRes = PylonDeviceFeatureFromString(hdev, "SequencerTriggerActivation", "RisingEdge");
CHECK(errRes);
/* Save the changes */
errRes = PylonDeviceExecuteCommandFeature(hdev, "SequencerSetSave");
CHECK(errRes);
/* Load and configure sequencer set 1 */
errRes = PylonDeviceSetIntegerFeature(hdev, "SequencerSetSelector", 1);
CHECK(errRes);
errRes = PylonDeviceExecuteCommandFeature(hdev, "SequencerSetLoad");
CHECK(errRes);
errRes = PylonDeviceSetIntegerFeature(hdev, "SequencerPathSelector", 0);
CHECK(errRes);
errRes = PylonDeviceSetIntegerFeature(hdev, "SequencerSetNext", 2);
CHECK(errRes);
errRes = PylonDeviceFeatureFromString(hdev, "SequencerTriggerSource", "Line3");
CHECK(errRes);
errRes = PylonDeviceFeatureFromString(hdev, "SequencerTriggerActivation", "RisingEdge");
CHECK(errRes);
/* Save the changes */
errRes = PylonDeviceExecuteCommandFeature(hdev, "SequencerSetSave");
CHECK(errRes);
/* Enable sequencer mode to operate the sequencer */
errRes = PylonDeviceFeatureFromString(hdev, "SequencerMode", "On");
CHECK(errRes);

You can also use the pylon Viewer to easily set the parameters.