ON THIS PAGE

  • Sync Node
  • How to Place it
  • Inputs and Outputs
  • Message Synchronization
  • Usage
  • Examples of Functionality
  • Reference

Sync Node

The Sync node is used for synchronizing multiple input streams based on their timestamps. It outputs a grouped message containing synchronized frames from the input streams. The output message is a MessageGroup containing synchronized messages from all the input streams. These can be demultiplexed using the MessageDemux node.

How to Place it

Python
C++
Python
1pipeline = dai.Pipeline()
2sync = pipeline.create(dai.node.Sync)

Inputs and Outputs

Command Line
1/
2                 ┌───────────────────┐
3  input1         │                   │
4  ──────────────►│                   │
5  input2         │                   │        out
6  ──────────────►│      Sync         ├───────────►
7                 │                   │
8  ...            │                   │
9  ──────────────►│                   │
10                 └───────────────────┘
Message types

Message Synchronization

The Sync node aligns incoming messages based on their timestamps. The synchronization criteria and behavior can be configured using the depthai.node.Sync.setSyncThreshold and depthai.node.Sync.setSyncAttempts method. More info in the Reference section.

Usage

Python
C++
Python
1pipeline = dai.Pipeline()
2sync = pipeline.create(dai.node.Sync)
3
4# Configure threshold for timestamp alignment
5sync.setSyncThreshold(timedelta(milliseconds=50))
6
7# Configure inputs to be synchronized
8camRgb.video.link(sync.inputs["input1"])
9stereo.depth.link(sync.inputs["input2"])
10
11sync.out.link(xout.input)
12# ...

Examples of Functionality

Reference

class

depthai.node.Sync(depthai.Node)

method
getSyncAttempts(self) -> int: int
Gets the number of sync attempts
method
getSyncThreshold(self) -> datetime.timedelta: datetime.timedelta
Gets the maximal interval between messages in the group in milliseconds
method
setSyncAttempts(self, maxDataSize: int)
Set the number of attempts to get the specified max interval between messages in
the group

Parameter ``syncAttempts``:
    Number of attempts to get the specified max interval between messages in the
    group: - if syncAttempts = 0 then the node sends a message as soon at the
    group is filled - if syncAttempts > 0 then the node will make syncAttemts
    attempts to synchronize before sending out a message - if syncAttempts = -1
    (default) then the node will only send a message if successfully
    synchronized
method
setSyncThreshold(self, syncThreshold: datetime.timedelta)
Set the maximal interval between messages in the group

Parameter ``syncThreshold``:
    Maximal interval between messages in the group
property
inputs
A map of inputs
property
out
Output message of type MessageGroup

Need assistance?

Head over to Discussion Forum for technical support or any other questions you might have.