ON THIS PAGE

  • How to Place It
  • Inputs and Outputs
  • Usage
  • Examples of Functionality
  • Reference

MessageDemux

Supported on:RVC2RVC4
The MessageDemux (Demultiplexer) node is used to separate a MessageGroup into individual outputs. It currently serves as way to demultiplex the output of Sync node.

How to Place It

Python

Python
1pipeline = dai.Pipeline()
2demux = pipeline.create(dai.node.MessageDemux)

C++

C++
1dai::Pipeline pipeline;
2auto demux = pipeline.create<dai::node::MessageDemux>();

Inputs and Outputs

Usage

The MessageDemux node is particularly useful for handling different types of data coming from a single source. For example, when the Sync node is used to synchronize the outputs of multiple nodes, the output of the Sync node is a MessageGroup containing all the messages from the synchronized nodes. The Demux node can be used to separate the messages into individual streams.

Python

Python
1# Create sync node and set sync threshold
2sync = pipeline.create(dai.node.Sync)
3sync.setSyncThresholdMs(timedelta(milliseconds=100))
4
5# Create demux node
6demux = pipeline.create(dai.node.MessageDemux)
7
8# Sync the outputs of multiple nodes
9rgb.preview.link(sync.inputs["rgb"])
10stereo.depth.link(sync.inputs["depth"])
11script.outputs["out"].link(sync.inputs["script"])
12
13sync.out.link(demux.input) # Sync output is a MessageGroup containing all the messages from the synchronized nodes
14
15# Demux the MessageGroup into individual messages
16demux.outputs["rgb"].link(xout1.input)
17demux.outputs["depth"].link(xout2.input)
18demux.outputs["script"].link(xout3.input)

C++

C++
1// Create sync node and set sync threshold
2auto sync = pipeline.create<dai::node::Sync>();
3sync->setSyncThreshold(std::chrono::milliseconds(100));
4
5// Create demux node
6auto demux = pipeline.create<dai::node::MessageDemux>();
7
8// Sync the outputs of multiple nodes
9rgb.preview.link(sync->input["rgb"]);
10stereo.depth.link(sync->input["depth"]);
11script.outputs["out"].link(sync->input["script"]);
12
13sync->out.link(demux->input); // Sync output is a MessageGroup containing all the messages from the synchronized nodes
14
15// Demux the MessageGroup into individual messages
16demux->outputs["rgb"].link(xout1.input);
17demux->outputs["depth"].link(xout2.input);
18demux->outputs["script"].link(xout3.input);

Examples of Functionality

Reference

class

dai::node::MessageDemux

variable
Input input
Input message of type MessageGroup
variable
OutputMap outputs
A map of outputs, where keys are same as in the input MessageGroup
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()
function
void setProcessor(ProcessorType type)
Specify on which processor the node should run. RVC2 only.
Parameters
  • type: Processor type - Leon CSS or Leon MSS
function
ProcessorType getProcessor()
Get on which processor the node should run
Returns
Processor type - Leon CSS or Leon MSS
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.