Precision Time Protocol (blaze)#
IEEE 1588規格でプロトコルが定義されています。Baslerカメラは、IEEE 1588-2008(PTP Version 2とも呼ばれる)をサポートしています。
情報
PTP同期の精度は、ネットワークのハードウェアとセットアップによって大きく異なります。最高の精度を得るには、高品質のネットワークハードウェアを選択し、PTP有効ネットワークスイッチを使用し、GPS受信機を備えた外部PTPクロックデバイスをネットワークに追加してください。
機能を使用する#
PTPを使用する理由#
The Precision Time Protocol (PTP) feature enables a blaze camera to use the Synchronous Free Run (blaze) feature.
Through PTP, the clocks of multiple cameras can be automatically synchronized with the most accurate clock found in a network, the so-called master clock or best master clock.
Depending on your system setup, the master clock can either be a camera or an external device:
- If your system only includes cameras, the cameras negotiate amongst themselves to determine the most accurate camera clock, which will then serve as the master clock.
- If your system includes an external device (e.g., a GPS receiver or an additional computer configured as master), the external device will act as the master clock.
When the cameras' clocks are synchronized, their timestamps can be compared against each other.
If the master clock in the network delivers absolute times based on the international time standard TAI, e.g., via a GPS receiver, the local time can be determined from the timestamps generated by the cameras' synchronized clocks.
If the master clock doesn't deliver TAI time, the clocks are running in synch but their times are on a random timescale, the so-called arbitrary timescale mode (ARB). In this mode, the epoch is arbitrary, as it is not bound to an absolute time. This timescale is relative, i.e., it is only valid in that network. The best master clock algorithm will select the clock with the highest stability and precision as the master clock of that network. Cameras acting as master clocks can't deliver TAI times, only ARB time.
PTP Clock Synchronizationの有効化#
カメラの電源をオンにすると、PTPは常に無効になります。PTPを使用する場合は、有効にする必要があります。
PTPを有効にするには、次の手順に従います。
- If you want to use an external device as the master clock (e.g., a GPS receiver), configure the external device as the master clock.
- On all cameras that you want to synchronize via PTP, set the
PtpEnable
parameter totrue
. - Wait until all PTP network devices are sufficiently synchronized. Depending on your network setup, this may take a few seconds or minutes.
To determine when the devices are synchronized, check the status of the PTP clock synchronization.
PTP Clock Synchronizationのステータスを確認する#
You must develop your own method for checking the status of the PTP clock synchronization using the blaze SDK.
Example of How to Check the PTP status
A typical implementation of a PTP status check includes the following steps:
- Enable PTP.
-
Wait for the Best Master Clock algorithm to finish. To determine whether the algorithm has finished, perform the following steps in a loop until the
PtpStatus
parameter value for all cameras is eitherMaster
orSlave
and no more than one camera returnsMaster
asPtpStatus
:- Execute the
PtpDataSetLatch
command on each camera.
The command allows you to take a "snapshot" of the camera's current PTP state. The "snapshot" implementation ensures that all parameter values refer to exactly the same point in time. - Read the
PtpStatus
parameter for each camera. - Wait until the clocks are sufficiently synchronized.
See the following section for instruction how to verify this.
- Execute the
How to Check Whether the Clocks are Sufficiently Synchronized
情報
For this, use the PtpOffsetFromMaster
parameter, which indicates how much a device's clock deviates from the clock of the master. You should wait until all these offsets are below a certain threshold (specified by you according to your requirements), e.g., 50 µs.
Due to the fact that the clock is adjusted continuously by a control mechanism, the offset will oscillate for a while around the master value with the amplitudes of the oscillations becoming smaller with time passing. Basler recommends checking that the maximum PtpOffsetFromMaster
parameter value is below the threshold for a certain period of time, e.g., for 10 seconds.
- Define a threshold for the offset values depending on your application requirements, e.g., 50 µs.
- Define the length of the time window during which you want the offset values to be below the threshold.
- Read out the current system time and use it as the start of the time window during which you want to check the
PtpOffsetFromMaster
parameter value. - Perform the following steps in a loop:
- On each camera, execute
PtpDataSetLatch
and read out thePtpOffsetFromMaster
parameter value.
Make a note of the values for later use. - Find the highest offset value.
- If one or more of the absolute offset values are above the threshold within the time window specified, reset the start of the time window to the current time and go back to step 1.
- If all absolute offset values are below the threshold for the whole length of the time window, stop the loop.
All clocks are sufficiently synchronized now.
- On each camera, execute
The following figure shows how the offset from master changes over time. The time window is represented by the red rectangle. The smaller the absolute value of the offset from the master, the higher the precision.