Sync
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
Python
1pipeline = dai.Pipeline()
2sync = pipeline.create(dai.node.Sync)
Inputs and Outputs
Message Synchronization
The Sync node aligns incoming messages based on their timestamps. The synchronization criteria and behavior can be configured using thedepthai.node.Sync.setSyncThreshold
and depthai.node.Sync.setSyncAttempts
method. More info in the Reference section.Sync Logic

Usage
Python
C++
Python
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
dai::node::Sync
variable
InputMap inputs
A map of inputs
variable
Output out
Output message of type MessageGroup
function
void setSyncThreshold(std::chrono::nanoseconds syncThreshold)
Set the maximal interval between messages in the group
Parameters
- syncThreshold: Maximal interval between messages in the group
function
void setSyncAttempts(int syncAttempts)
Set the number of attempts to get the specified max interval between messages in the group
Parameters
- 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
function
std::chrono::nanoseconds getSyncThreshold()
Gets the maximal interval between messages in the group in milliseconds
function
int getSyncAttempts()
Gets the number of sync attempts
function
void setRunOnHost(bool runOnHost)
Specify whether to run on host or device By default, the node will run on device.
function
bool runOnHost()
Check if the node is set to run on host
function
void run()
inline function
DeviceNodeCRTP()
inline function
DeviceNodeCRTP(const std::shared_ptr< Device > & device)
inline function
DeviceNodeCRTP(std::unique_ptr< Properties > props)
inline function
DeviceNodeCRTP(std::unique_ptr< Properties > props, bool confMode)
inline function
DeviceNodeCRTP(const std::shared_ptr< Device > & device, std::unique_ptr< Properties > props, bool confMode)
Need assistance?
Head over to Discussion Forum for technical support or any other questions you might have.