FG Camera Library  1.6.0.0 (2024-12-03)
VisionSensor PV

The VisionSensor PV is a compact programmable Linux camera. Unlike the VisionCam, it does not provide a "Real Time Communication Controller" (RTCC). Sensor trigger and the integrated LED are controlled by this libraray, while the digital I/Os are controlled by the VisionBox Interface Library.

There are two generations:

  • VisionSensor PV1 / PV2: single-core ARM Cortex-A9 (armhf architecture).
  • VisionSensor PV3: quad-core ARM Cortex-A57 (arm64 architecture).

Also take a look at the Sensors page for more information.

Hardware trigger

The function FG_set_trigger_mode() is used to configure one of the trigger modes:

  • Free-run
  • Software triggered
  • Hardware triggered

Example:

// Enable hardware trigger
Note
The debounce setting for the digital inputs will also be applied for the trigger signal in hardware triggered mode. See VIB::DigitalInput::ConfigureDebounceTime() for adjustment of the debouncing time.

VisionSensor PV / PV2 hardware trigger

The VisionSensor PV / PV2 uses a fixed connection from digital input IN0 to the sensor in hardware triggered mode. Therefore, no additional initialization code is necessary. The rising edge will be used.

VisionSensor PV3 hardware trigger

The VisionSensor PV3 provides the special feature TriggerLine to control the trigger signal and the edge sensitivity.

The feature TriggerDivider can be used to decrease the frequency of the trigger events. The divider counts trigger events based on the TriggerLine setting and triggers the sensor after reaching the specified value.

Property name Description Version requirements
FPGA Library
TriggerLine Selects the trigger signal in hardware triggered mode.
IN1 is not available when using FrameTriggerMode 2 and 3.
0: IN0, rising edge (default)
1: IN1, rising edge
2: IN0, falling edge
3: IN1, falling edge
4: IN0, rising and falling edge
5: IN1, rising and falling edge
6: IN0 + IN1, rising and falling edges
VisionSensor PV3 with I/O Expansion:
100...115: VIB::Multiplexer output line 0...15, rising edge
≥ 1.0.0.68 for values ≥ 2,
≥ 1.0.0.75 for values ≥ 100,
≥ 1.2.9.0
TriggerDivider
1...65536: divider value (default: 1)
≥ 1.0.0.68

Example:

// Select input IN1, rising edge as sensor trigger:
FG_set_special_option("TriggerLine", 1);
// Divide incoming trigger signal by 10:
FG_set_special_option("TriggerDivider", 10);

If the sensor is used in Line scan mode, an additional frame trigger signal can be configured by using the special feature FrameTriggerMode.

Controlling the integrated LED and exposure signal output

The operating mode of the integrated LED unit and the exposure output signal can be controlled by a physical mode switch or by software:

  • If the integrated LED is enabled, the LED turns on during the integration period of the sensor. The image brightness can only be changed by adjusting the integration time with FG_set_shutter_time().
  • The exposure signal of the sensor can be copied to a digital OUT wire. This allows synchronization of an external lighting unit. The output signal can be selected with the special feature StrobeOutput.

The position of the physical switch is used for mode selection unless it's overwritten by software. For software mode control, use the special feature StrobeMode. The value for this parameter is equal to the switch position for modes 0...2:

Strobe modes
Switch position Software control
(StrobeMode)
Integrated LED Digital output OUT<i>
0 0 Enabled Controlled by VIB::DigitalOutput
1 1 Off Sensor exposure signal
2 2 Off Controlled by VIB::DigitalOutput
- 3 Enabled Sensor exposure signal
- -1 Controlled by switch
Note
The mode switch is not present on most devices and is therefore only controlled by software.
Special features for strobe
Property name Description Library
StrobeMode Sets the operating mode for the integrated LED and the exposure signal for replacing the physical mode switch.
-1...3: strobe mode (default: 2 if no switch is present)
Note
For the VisionSensor PV/PV2, this feature requires PRU firmware ≥ 1.1.0.0.
≥ 1.2.0.0
StrobeOutput Selects the digital output line for the external exposure signal.
0...<i>: index of digital output signal OUT<i> (default: 0)
Note
For the VisionSensor PV/PV2, this feature requires PRU firmware ≥ 1.3.0.0.
≥ 1.2.3.0

Example:

// Enable the integrated LED and exposure signal on digital output:
FG_set_special_option("StrobeMode", 3);
// Select output OUT1 for the exposure signal:
FG_set_special_option("StrobeOutput", 1);
Note
The maximum LED strobe time gets automatically limited to a duty cycle of 25% for protection of the hardware. For example: when using a frame rate of 60 fps, the LED strobe time will be dynamically limited to 4.17 ms if the exposure time setting is longer. The external strobe signal on digital outputs will not be limited.

LED current (VisionSensor PV3)

The LED current can be adjusted for the following hardware:

  • Multi-channel LED illumination unit
  • Adjustable ring light

The LED current is controlled by the following special feature:

Property name Description Version requirements
FPGA Library
LedCurrent LED current in percent, the minimum value depends on the LED hardware
x...100
Default value for multi-channel LED illumination unit: 100
Default value for adjustable ring light: 28 (similar to non-adjustable version)
≥ 1.0.0.70 (for adjustable ring light only) ≥ 1.4.0.0

Sequencer (VisionSensor PV3)

A sequencer can be used to apply different settings to subsequent sensor frames:

  • Trigger mode: enable or disable sensor trigger
  • Control flash parameters for the multi-channel LED illumination unit

The sequencer is configured using special features as follows:

  • Configure the number of sequencer steps with SequencerStepCount
  • For each sequencer step:
    • Select the step with SequencerStep
    • Configure the selected step parameters

The sequencer is controlled by the following special features:

Special features for the sequencer
Property name Description Version requirements
FPGA Library
SequencerStepCount Number of active Sequencer steps
1...4 (default: 1)
≥ 1.0.0.70 ≥ 1.4.0.0
SequencerStep Selected Sequencer step index for using the following special options:
SequencerTriggerMode, SequencerFlashTime, SequencerFlashEnable
0...(SequencerStepCount - 1) (default: 0)
SequencerTriggerMode Trigger mode for the selected Sequencer step. This setting is ignored in free run mode:
0: disable sensor trigger for this step, acquire image when the sensor is ready
1: enable sensor trigger for this step (default)
SequencerFlashEnable LED illumination unit: a bit field for selecting active LED channels for the selected Sequencer step.
0x0...0xf (default: 0x3 - channel 0+1 for step 0, else 0x0)
SequencerFlashTime LED illumination unit: strobe duration for the selected Sequencer step in micro-seconds.
1...16384 (default: 100)

Correlation between acquired images and the used sequencer step can be done in two ways:

  • By using remainder of the frame number FG_IMAGE::image_number divided by the number of sequencer steps. The frame number will also be incremented if frames are lost when the acquisition queue is empty.
  • Accumulate multiple sensor scans into one image by using FG_set_scan_param() and setting the parameter image_scan_count equal to the number of sequencer steps. The resulting image will contain the sensor images for all steps after another in memory.
Note
The number of sequencer steps should be configured before starting image acquisition with FG_append_image() to ensure the correlation.

Sequencer trigger mode setting

The trigger mode can be used to enable or disable the sensor trigger for each sequencer step.

The trigger is activated by default for all steps, so the sensor will wait for a trigger signal (hardware or software trigger). If the trigger mode is disabled for a sequencer step, the sensor will start acquisition as soon as the previous sensor exposure and readout has completed.

Example:

The following example configures the sequencer to capture three frames for each trigger event:

// number of sequencer steps: 3
FG_set_special_option("SequencerStepCount", 3);
// disable trigger for steps 1 and 2 (trigger for step 0 stays active)
FG_set_special_option("SequencerStep", 1);
FG_set_special_option("SequencerTriggerMode", 0);
FG_set_special_option("SequencerStep", 2);
FG_set_special_option("SequencerTriggerMode", 0);

In free-run mode, the sequencer trigger mode setting affects the acquisition as follows:

  • If the trigger is active for a step, the sensor will be triggered according to the FrameRate / ScanPeriod setting.
  • If the trigger is disabled for a step, the sensor will be triggered as soon as possible.

Sequencer LED illumination unit settings

The following LED parameters can be changed for each sequencer step when using the multi-channel LED illumination unit:

  • SequencerFlashTime: controls the LED flash duration
  • SequencerFlashEnable: a bit field controlling the active LED channels
Note
  • The LED current (option LedCurrent) is the same for all LED channels and for all sequencer steps.
  • The actual LED current may be limited to less than 100 percent if multiple LED channels are used simultaneously in any sequencer step. Read the current value back to get the actual value.
  • The maximum allowed duty cycle is calculated by the library for each LED channel to protect against hardware damage.

Example:

// number of sequencer steps: 3
FG_set_special_option("SequencerStepCount", 3);
// configure step 0
FG_set_special_option("SequencerStep", 0);
FG_set_special_option("SequencerFlashEnable", 0x3); // enable LED channel 0 and 1
FG_set_special_option("SequencerFlashTime", 400); // 400 micro-seconds
// configure step 1
FG_set_special_option("SequencerStep", 1);
FG_set_special_option("SequencerFlashEnable", 0x4); // enable LED channel 2
FG_set_special_option("SequencerFlashTime", 1000); // 1000 micro-seconds
// configure step 2
FG_set_special_option("SequencerStep", 2);
FG_set_special_option("SequencerFlashEnable", 0x8); // enable LED channel 3
FG_set_special_option("SequencerFlashTime", 200); // 200 micro-seconds
FG_TRIGGER_MODE_HARDWARE
@ FG_TRIGGER_MODE_HARDWARE
Hardware triggered mode.
Definition: FG_CameraInterface.h:147
FG_set_special_option
UINT32 DLL_FG_API FG_set_special_option(const char *option, INT64 arg)
Configures a special camera property.
Definition: FG_CameraInterface.cpp:973
FG_set_trigger_mode
UINT32 DLL_FG_API FG_set_trigger_mode(enum eFG_TRIGGER_MODE trigger_mode)
Sets the trigger mode.
Definition: FG_CameraInterface.cpp:850