コンテンツにスキップ

Periodic Signal#

Periodic Signalカメラ機能を使用すると、デバイス間で同期される定期的なトリガー信号を生成できます。

これにより、複数のカメラで同時に同じフレームレートで画像をキャプチャしたりできます。

この機能はSynchronous Free Run機能に似ていますが、画像取得以外に、他の目的にも使用できます。

機能を使用する#

仕組み#

Basler cameras supporting the Periodic Signal feature provide an additional camera signal source, PeriodicSignal1. Via this source, the camera transmits a signal with the following characteristics:

  • 信号は反復的です。
  • 信号は、Precision Time Protocolを介してデバイス間で同期できます。
  • 信号の周期を設定できます。
  • 最初の期間までの遅延を設定できます。

イメージ PeriodicSignal1 signal source can be used for many different purposes, e.g., to synchronize counters or image acquisition across devices.

Periodic Signalを使用して画像取得を同期する#

複数のカメラで画像取得を同期するには、次の手順に従います。

  1. Periodic Signalを使用して同期するカメラの1つを開きます。.
  2. Make sure that the BslPeriodicSignalSource parameter on the camera is set to PtpClock.
    This indicates that the camera is synchronized via the Precision Time Protocol feature.
  3. パラメーターを BslPeriodicSignalPeriod parameter to the reciprocal of the desired frame rate, converted to microseconds. For example, if you want to synchronize the cameras at 50 frames per second, set the parameter to 20000 (1 / 50 = 0.02 seconds = 20000 microseconds). You must specify the same parameter value on all cameras.
  4. 定期的な信号遅延を、次のように設定します。
    • If you want all cameras to acquire images at the same time, set the BslPeriodicSignalDelay parameter to 0 on all cameras.
    • If you want all cameras to acquire images sequentially, i.e, in regular intervals, set the BslPeriodicSignalDelay parameter to 0 on the first camera and to multiples of the desired interval on the other cameras.
      For example, assume you want to acquire images with an interval of 10000 µs between cameras. To do so, set the delay to 0 on the first camera, to 10000 on the second camera, to 20000 on the third camera, and so on.
  5. 定期的な信号によってトリガーされるようにカメラを設定します。
    1. パラメーターを TriggerSelector parameter to FrameStart.
    2. パラメーターを TriggerMode parameter to On.
    3. パラメーターを TriggerSource parameter to PeriodicSignal1.
  6. すべてのカメラについて、手順1~5を繰り返します。

Periodic Signalを使用して外部デバイスを同期的にトリガーする#

Periodic Signal機能を使用して、外部デバイスを同期的にトリガーできます。これにより、非PTPデバイスPTP対応にできます。

カメラの内部周期信号をI/O信号として使用することはできません。ただし、周期信号を使用してカメラのTimer機能をトリガーし、タイマー信号をI/O信号として使用することは可能です。

これを行うには:

  1. 外部デバイスの起動に使用するカメラを開きます。
  2. Make sure that the BslPeriodicSignalSource parameter on the camera is set to PtpClock.
    This indicates that the camera is synchronized via the Precision Time Protocol feature.
  3. パラメーターを BslPeriodicSignalPeriod parameter to the reciprocal of the desired trigger rate, converted to microseconds. For example, if you want to generate 20 trigger signals per second, set the parameter to 50000 (1/20 = 0.05 seconds = 50000 microseconds).
  4. If you want to trigger the external device with a time delay, set the BslPeriodicSignalDelay parameter to the desired delay.
  5. カメラを設定 Timer 定期的な信号によって起動される機能:
    1. パラメーターを TimerSelector parameter to Timer1.
    2. パラメーターを TimerDuration parameter to the desired timer duration in microseconds.
      The camera will send an I/O signal with a width equal to this value. Therefore, set a parameter value high enough for the external device to be able to receive the signal. In most cases, the default value of 10 µs should be sufficient.
    3. パラメーターを TimerTriggerSource parameter to PeriodicSignal1.
  6. タイマー信号を出力するようにカメラを設定します:
    1. パラメーターを LineSelector parameter to the desired I/O line, e.g., Line2. The line must be configured as output.
    2. パラメーターを LineSource parameter to Timer1Active.
  7. 外部デバイスをステップ6で選択した出力ラインに接続します。
    これで、デバイスはこのラインで同期されたトリガー信号を受信するようになります。
  8. If you want to trigger another external device, repeat steps 1 to 6, using Timer2 and Timer2Active in steps 5 and 6.

情報

また、カメラ間で画像取得を同期し、さらに同じ周期信号を使用して外部デバイスを同期的に起動することもできます。これを行うには、上記の手順を両方とも実行します。

追加パラメーター#

  • BslPeriodicSignalSelector: Sets the periodic signal channel to be configured. Because all Basler cameras currently offer one channel, this parameter is preset to PeriodicSignal1 and can't be changed.

サンプルコード#

/* Using Periodic Signal to Synchronize Image Acquisition */
// Set the signal period to 20000 µs
camera.BslPeriodicSignalPeriod.SetValue(20000.0);
// Set the signal delay to 0
camera.BslPeriodicSignalDelay.SetValue(0);
// Configure the camera to be triggered by the periodic signal
camera.TriggerSelector.SetValue(TriggerSelector_FrameStart);
camera.TriggerMode.SetValue(TriggerMode_On);
camera.TriggerSource.SetValue(TriggerSource_PeriodicSignal1);

/* Using Periodic Signal to Synchronously Trigger External Devices */
// Set the signal period to 50000 µs
camera.BslPeriodicSignalPeriod.SetValue(50000.0);
// Set the signal delay to 0
camera.BslPeriodicSignalDelay.SetValue(0);
// Configure the camera's Timer feature to be triggered by periodic signals
camera.TimerSelector.SetValue(TimerSelector_Timer1);
camera.TimerDuration.SetValue(10.0);
camera.TimerTriggerSource.SetValue(TimerTriggerSource_PeriodicSignal1);
// Configure the camera to output the timer signal on Line 2
camera.LineSelector.SetValue(LineSelector_Line2);
camera.LineMode.SetValue(LineMode_Output);
camera.LineSource.SetValue(LineSource_Timer1Active);
INodeMap& nodemap = camera.GetNodeMap();
/*Using Periodic Signal to Synchronize Image Acquisition*/

CFloatParameter(nodemap, "BslPeriodicSignalPeriod").SetValue(20000.0);
// Set the signal delay to 0
CIntegerParameter(nodemap, "BslPeriodicSignalDelay").SetValue(0);
// Configure the camera to be triggered by the periodic signal
CEnumParameter(nodemap, "TriggerSelector").SetValue("FrameStart");
CEnumParameter(nodemap, "TriggerMode").SetValue("On");
CEnumParameter(nodemap, "TriggerSource").SetValue("PeriodicSignal1");

/*Using Periodic Signal to Synchronously Trigger External Devices*/

CFloatParameter(nodemap, "BslPeriodicSignalPeriod").SetValue(50000.0);
// Set the signal delay to 0
CIntegerParameter(nodemap, "BslPeriodicSignalDelay").SetValue(0);
// Configure the camera's Timer feature to be triggered by periodic signals
CEnumParameter(nodemap, "TimerSelector").SetValue("Timer1");
CFloatParameter(nodemap, "TimerDuration").SetValue(10.0);
CEnumParameter(nodemap, "TimerTriggerSource").SetValue("PeriodicSignal1");
// Configure the camera to output the timer signal on Line 2
CEnumParameter(nodemap, "LineSelector").SetValue("Line2");
CEnumParameter(nodemap, "LineMode").SetValue("Output");
CEnumParameter(nodemap, "LineSource").SetValue("Timer1Active");
/*Using Periodic Signal to Synchronize Image Acquisition*/

camera.Parameters[PLCamera.BslPeriodicSignalPeriod].SetValue(20000.0);
// Set the signal delay to 0
camera.Parameters[PLCamera.BslPeriodicSignalDelay].SetValue(0);
// Configure the camera to be triggered by the periodic signal
camera.Parameters[PLCamera.TriggerSelector].SetValue(PLCamera.TriggerSelector.FrameStart);
camera.Parameters[PLCamera.TriggerMode].SetValue(PLCamera.TriggerMode.On);
camera.Parameters[PLCamera.TriggerSource].SetValue(PLCamera.TriggerSource.PeriodicSignal1);

/*Using Periodic Signal to Synchronously Trigger External Devices*/

camera.Parameters[PLCamera.BslPeriodicSignalPeriod].SetValue(50000.0);
// Set the signal delay to 0
camera.Parameters[PLCamera.BslPeriodicSignalDelay].SetValue(0);
// Configure the camera's Timer feature to be triggered by periodic signals
camera.Parameters[PLCamera.TimerSelector].SetValue(PLCamera.TimerSelector.Timer1);
camera.Parameters[PLCamera.TimerDuration].SetValue(10.0);
camera.Parameters[PLCamera.TimerTriggerSource].SetValue(PLCamera.TimerTriggerSource.PeriodicSignal1);
// Configure the camera to output the timer signal on Line 2
camera.Parameters[PLCamera.LineSelector].SetValue(PLCamera.LineSelector.Line2);
camera.Parameters[PLCamera.LineMode].SetValue(PLCamera.LineMode.Output);
camera.Parameters[PLCamera.LineSource].SetValue(PLCamera.LineSource.Timer1Active);
/* 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 */
/*Using Periodic Signal to Synchronize Image Acquisition*/

errRes = PylonDeviceSetFloatFeature(hdev, "BslPeriodicSignalPeriod", 20000.0);
CHECK(errRes);
/* Set the signal delay to 0 */
errRes = PylonDeviceSetIntegerFeature(hdev, "BslPeriodicSignalDelay", 0);
CHECK(errRes);
/* Configure the camera to be triggered by the periodic signal */
errRes = PylonDeviceFeatureFromString(hdev, "TriggerSelector", "FrameStart");
CHECK(errRes);
errRes = PylonDeviceFeatureFromString(hdev, "TriggerMode", "On");
CHECK(errRes);
errRes = PylonDeviceFeatureFromString(hdev, "TriggerSource", "PeriodicSignal1");
CHECK(errRes);

/*Using Periodic Signal to Synchronously Trigger External Devices*/

errRes = PylonDeviceSetFloatFeature(hdev, "BslPeriodicSignalPeriod", 50000.0);
CHECK(errRes);
/* Set the signal delay to 0 */
errRes = PylonDeviceSetIntegerFeature(hdev, "BslPeriodicSignalDelay", 0);
CHECK(errRes);
/* Configure the camera's Timer feature to be triggered by periodic signals */
errRes = PylonDeviceFeatureFromString(hdev, "TimerSelector", "Timer1");
CHECK(errRes);
errRes = PylonDeviceSetFloatFeature(hdev, "TimerDuration", 10.0);
CHECK(errRes);
errRes = PylonDeviceFeatureFromString(hdev, "TimerTriggerSource", "PeriodicSignal1");
CHECK(errRes);
/* Configure the camera to output the timer signal on Line 2 */
errRes = PylonDeviceFeatureFromString(hdev, "LineSelector", "Line2");
CHECK(errRes);
errRes = PylonDeviceFeatureFromString(hdev, "LineMode", "Output");
CHECK(errRes);
errRes = PylonDeviceFeatureFromString(hdev, "LineSource", "Timer1Active");
CHECK(errRes);
# Using Periodic Signal to Synchronize Image Acquisition
camera.BslPeriodicSignalPeriod.Value = 20000.0
# Set the signal delay to 0
camera.BslPeriodicSignalDelay.Value = 0
# Configure the camera to be triggered by the periodic signal
camera.TriggerSelector.Value = "FrameStart"
camera.TriggerMode.Value = "On"
camera.TriggerSource.Value = "PeriodicSignal1"

# Using Periodic Signal to Synchronously Trigger External Devices
camera.BslPeriodicSignalPeriod.Value = 50000.0
# Set the signal delay to 0
camera.BslPeriodicSignalDelay.Value = 0
# Configure the camera's Timer feature to be triggered by periodic signals
camera.TimerSelector.Value = "Timer1"
camera.TimerDuration.Value = 10.0
camera.TimerTriggerSource.Value = "PeriodicSignal1"
# Configure the camera to output the timer signal on Line 2
camera.LineSelector.Value = "Line2"
camera.LineMode.Value = "Output"
camera.LineSource.Value = "Timer1Active"

pylon Viewerを使用して、パラメーターを簡単に設定することもできます。