跳转到内容

Synchronous Free Run#

相机的 Synchronous Free Run 功能可让您以相同的帧速率同时在多台相机上采集图像。

此功能类似于 Periodic Signal 功能,仅适用于 Basler ace 2 相机。

该功能的使用#

运作原理#

如果您在自由运行模式下使用多台相机,则由于多种原因(例如,相机各自的计时和延迟),图像采集会略失去同步。

相机以相同的帧速率拍摄,但异步运行

Synchronous Free Run 功能可让您在自由运行模式下同步相机。相机将因此以相同的帧速率同时采集图像。

相机以相同的帧速率同时拍摄

另外,您可以使用 Synchronous Free Run 功能,按时序一致的间隔(即按时间顺序)用多台相机采集图像。例如,您可以配置一台相机为在特定时间点开始图像采集。然后将另一台相机配置为比第一台相机晚 100 毫秒开始采集,将第三台相机配置为比第一台相机晚 200 毫秒开始采集:

相机按时序一致的间隔拍摄

另外,您可以配置相机,以按照相同的时间、相同的帧速率、不同的曝光时间来采集图像:

相机使用不同的曝光时间拍摄

使用 Synchronous Free Run#

一般用法#

要同步多台相机:

  1. 通过 Precision Time Protocol 功能确保网络中的所有相机均已同步。
  2. 打开您要使用 Synchronous Free Run 进行同步的其中一个相机。
  3. 确保在此相机上启用了自由运行图像采集
  4. Enter the desired frame rate for the SyncFreeRunTimerTriggerRateAbs parameter.
    You must specify the same parameter value on all cameras. For example, to synchronize the cameras at 10 frames per second, you must set the parameter to 10 on all cameras.
  5. Set the SyncFreeRunTimerStartTimeHigh and the SyncFreeRunTimerStartTimeLow parameters to 0.
  6. Execute the SyncFreeRunTimerUpdate command.
  7. Set the SyncFreeRunTimerEnable parameter to true.
  8. 对所有相机重复步骤 2 至 7。

信息

Basler recommends executing the SyncFreeRunTimerUpdate command on all cameras whenever a camera is disconnected and then reconnected. This resynchronizes the PTP clocks.

Synchronous Free Run 具有时序一致的间隔#

要按时序一致的间隔(即按时间顺序排列)同步多台相机:

信息

必须使用 pylon API 执行以下步骤。

  1. 通过 Precision Time Protocol 功能确保网络中的所有相机均已同步。
  2. 按时间顺序打开第一个相机。
  3. 确保在此相机上启用了自由运行图像采集
  4. Enter the desired frame rate for the SyncFreeRunTimerTriggerRateAbs parameter.
    You must specify the same parameter value on all synchronized cameras. For example, if you want the cameras to acquire 10 frames per second, you must set the parameter to 10 on all cameras.
  5. 确定第一台相机的开始时间:

    1. Execute the TimestampLatch command on the first camera.
      A "snapshot" of the camera's current timestamp value is taken.
    2. Get the value of the TimestampLatchValue parameter on the same camera.
      The value is specified in ticks. On Basler cameras with the Precision Time Protocol feature enabled, one tick equals one nanosecond.
    3. 将以 tick(= 纳秒)为单位的开始延迟与步骤 b 中确定的值相加。
      例如,要指定 1 秒的开始延迟,请将 1 000 000 000 加到步骤 b 中确定的值上。
      之所以需要延迟,是因为第一台相机必须等待,直到其他相机正确完成配置为止:

      Synchronous Free Run 启动延迟

  6. Convert the value determined in step 5 to start time high and start time low values and set the SyncFreeRunTimerStartTimeHigh and the SyncFreeRunTimerStartTimeLow parameters accordingly.

  7. Execute the SyncFreeRunTimerUpdate command.
  8. Set the SyncFreeRunTimerEnable parameter to true.
  9. 按时间顺序打开下一台相机。
  10. 在此相机上启用自由运行图像采集
  11. Enter the desired frame rate for the SyncFreeRunTimerTriggerRateAbs parameter.
    You must specify the same parameter value on all synchronized cameras. For example, if you want the cameras to acquire 10 frames per second, set the parameter to 10 on all cameras.
  12. 将所需的时间间隔(以纳秒为单位)加到第一台相机的开始时间上(在步骤 5 中确定)。
    例如,如果您希望相机在第一台相机之后的 100 毫秒后开始图像采集,则将 100 000 000 加到步骤 5 中确定的值上。
  13. Convert the value determined in step 12 to start time high and start time low values and configure the SyncFreeRunTimerStartTimeHigh and the SyncFreeRunTimerStartTimeLow parameters accordingly.
  14. Execute the SyncFreeRunTimerUpdate command.
  15. Set the SyncFreeRunTimerEnable parameter to true.
  16. 对其余所有相机重复步骤 9 至 15。

信息

Whenever a camera is disconnected and then reconnected, the SyncFreeRunTimerUpdate command must be executed on all cameras to resynchronize the PTP clocks.

转换 64 位时间戳开始时间高值和开始时间低值#

Synchronous Free Run 功能的开始时间必须指定为 64 位 GigE Vision 时间戳值(以纳秒为单位),分为两个 32 位值。

The high part of the 64-bit value must be transmitted using the SyncFreeRunTimerStartTimeHigh parameter.

The low part of the 64-bit value must be transmitted using the SyncFreeRunTimerStartTimeLow parameter.

示例:假设根据 UTC 时间协调您的网络设备,并且您想将 Fri Dec 12 2025 11:00:00 UTC 配置为开始时间。这对应于时间戳值 1 765 537 200 000 000 000(十进制)或 0001 1000 1000 0000 0111 0010 1011 1010 1010 1011 1011 1100 1110 0000 0000 0000(二进制)。

此值的高低部分分别如下:

时间戳值的高低部分

Therefore, to configure a start time of Fri Dec 12 2025 11:00:00 UTC, you must set the SyncFreeRunTimerStartTimeHigh parameter to 411 071 162 and the SyncFreeRunTimerStartTimeLow parameter to 2 881 282 048.

示例代码#

// Example: Configuring cameras for synchronous free run.
// It is assumed that the "cameras" object is an
// instance of CBaslerGigEInstantCameraArray.
for (size_t i = 0; i > cameras.GetSize(); ++i)
{
    // Open the camera connection
    cameras[i].Open();
    // Make sure that the Frame Start trigger is set to Off to enable free run
    cameras[i].TriggerSelector.SetValue(TriggerSelector_FrameStart);
    cameras[i].TriggerMode.SetValue(TriggerMode_Off);
    // Let the free run start immediately without a specific start time
    camera.SyncFreeRunTimerStartTimeLow.SetValue(0);
    camera.SyncFreeRunTimerStartTimeHigh.SetValue(0);
    // Specify a trigger rate of 30 frames per second
    cameras[i].SyncFreeRunTimerTriggerRateAbs.SetValue(30.0);
    // Apply the changes
    cameras[i].SyncFreeRunTimerUpdate.Execute();
    // Enable Synchronous Free Run
    cameras[i].SyncFreeRunTimerEnable.SetValue(true);
}

此示例代码仅适用于 C++ 语言。