Device Nodes
Nodes are the building blocks when populating the Pipeline. Each node provides a specific functionality on the DepthAI, a set of configurable properties and inputs/outputs. After you create a node on a pipeline, you can also configure it as desired and link it to other nodes.A device node is a special type of node, which is run on device SoC (RVC) utilizing the resources of the device. Device nodes are used to offload the host from processing tasks that can be done on the device itself. Alternatively, host nodes can be used to perform computation on the host (PC).On the table of contents (left side of the page) all nodes are listed under theNode
entry. You can click on them to find out more.Inputs and outputs
Each node can have zero, one or multiple inputs and outputs. For example, SystemLogger node has no inputs and 1 output and EdgeDetector has 2 inputs and 1 output (as shown below). Script node can have any number of inputs/ouputs.Each node's output has its pool; block in RAM where it stores messages. Each node's input has its queue for message pointers (doesn't store the message itself, just a pointer to it).
Node input
Node input queue is a queue for Messages. It can be linked with other node's output (that's how you link up nodes). Node inputs are configurable - withinput.setBlocking(bool)
and input.setQueueSize(num)
, eg. edgeDetector.inputImage.setQueueSize(10)
. If the input queue fills up, behavior of the input depends on blocking attribute.Let's say we have linked ColorCamera preview
output with NeuralNetwork input
input.
Node output
Node outputs Messages. Some nodes have a configurable output message pool. Output message pool is a reserved memory region (to reduce memory fragmentation) that holds output messages. After the node creates an output message (for example ImgFrame), it will send it to other nodes as specified when linking the inputs/outputs of the node. Currently, some nodes (VideoEncoder, NeuralNetwork, ImageManip, XLinkIn) can have the pool size configured. The size of the pool specifies how many messages can be created and sent out while other messages are already somewhere in the pipeline.Pipeline freezing
When all the messages from pool are sent out and none yet returned, that's when the node will block (freeze) and wait until a message is released (not used by any node in the pipeline).
class
dai::Node
variable
Id id
variable
std::string alias
function
Node(const Node &)
function
function
Node(Node &&)
function
function
Pipeline getParentPipeline()
function
const Pipeline getParentPipeline()
inline function
std::string getAlias()
inline function
void setAlias(std::string alias)
function
const char * getName()
inline function
void start()
inline function
void wait()
inline function
void stop()
function
void stopPipeline()
function
void buildStage1()
function
void buildStage2()
function
void buildStage3()
function
std::vector< Output > getOutputs()
function
std::vector< Input > getInputs()
function
std::vector< Output * > getOutputRefs()
function
std::vector< const Output * > getOutputRefs()
function
std::vector< Input * > getInputRefs()
function
std::vector< const Input * > getInputRefs()
function
std::vector< OutputMap * > getOutputMapRefs()
function
std::vector< InputMap * > getInputMapRefs()
function
Output * getOutputRef(std::string name)
function
Output * getOutputRef(std::string group, std::string name)
function
Input * getInputRef(std::string name)
function
Input * getInputRef(std::string group, std::string name)
function
OutputMap * getOutputMapRef(std::string group)
function
InputMap * getInputMapRef(std::string group)
function
bool isSourceNode()
function
~Node()
function
const AssetManager & getAssetManager()
function
AssetManager & getAssetManager()
function
std::vector< uint8_t > loadResource(dai::Path uri)
function
std::vector< uint8_t > moveResource(dai::Path uri)
inline function
std::shared_ptr< N > create()
function
void add(std::shared_ptr< Node > node)
function
std::vector< std::shared_ptr< Node > > getAllNodes()
function
function
function
void remove(std::shared_ptr< Node > node)
function
ConnectionMap getConnectionMap()
function
void link(const Node::Output & out, const Node::Input & in)
function
void unlink(const Node::Output & out, const Node::Input & in)
function
void link(std::shared_ptr< Node > in)
function
Node::Output * requestOutput(const Capability & capability, bool onHost)
function
std::vector< std::pair< Input &, std::shared_ptr< Capability > > > getRequiredInputs()
function
bool runOnHost()
inline function
const NodeMap & getNodeMap()
inline function
void buildInternal()
struct
dai::Node::Connection
variable
Id outputId
variable
std::string outputName
variable
std::string outputGroup
variable
Id inputId
variable
std::string inputName
variable
std::string inputGroup
function
function
Connection(ConnectionInternal c)
function
bool operator==(const Connection & rhs)
struct
dai::Node::ConnectionInternal
variable
std::weak_ptr< Node > outputNode
variable
std::string outputName
variable
std::string outputGroup
variable
std::weak_ptr< Node > inputNode
variable
std::string inputName
variable
std::string inputGroup
variable
Output * out
variable
Input * in
function
function
bool operator==(const ConnectionInternal & rhs)
struct
dai::Node::ConnectionInternal::Hash
function
size_t operator()(const dai::Node::ConnectionInternal & obj)
struct
dai::Node::DatatypeHierarchy
variable
DatatypeEnum datatype
variable
bool descendants
inline function
DatatypeHierarchy(DatatypeEnum d, bool c)
class
dai::Node::Input
variable
std::vector< DatatypeHierarchy > possibleDatatypes
inline explicit function
Input(Node & par, InputDescription desc, bool ref)
inline function
const Node & getParent()
Get the parent node
inline function
Node & getParent()
Get the parent node
inline function
Type getType()
Get type
function
std::string toString()
Input to string representation
function
void setWaitForMessage(bool waitForMessage)
Overrides default wait for message behavior. Applicable for nodes with multiple inputs. Specifies behavior whether to wait for this input when a Node processes certain data or not.
Parameters
- waitForMessage: Whether to wait for message to arrive to this input or not
function
bool getWaitForMessage()
Get behavior whether to wait for this input when a Node processes certain data or not
Returns
Whether to wait for message to arrive to this input or not
function
std::vector< DatatypeHierarchy > getPossibleDatatypes()
Get possible datatypes that can be received
function
void setPossibleDatatypes(std::vector< DatatypeHierarchy > types)
Set possible datatypes that can be received
function
void setReusePreviousMessage(bool reusePreviousMessage)
Equivalent to setWaitForMessage but with inverted logic.
function
bool getReusePreviousMessage()
Equivalent to getWaitForMessage but with inverted logic.
function
void setGroup(std::string group)
Set group name for this input
function
std::string getGroup()
Get group name for this input
function
bool isConnected()
Check if this input is connected
function
std::shared_ptr< InputQueue > createInputQueue(unsigned int maxSize, bool blocking)
enum
Type
enumerator
SReceiver
enumerator
MReceiver
struct
dai::Node::InputDescription
variable
std::string name
variable
std::string group
variable
bool blocking
variable
int queueSize
variable
std::vector< DatatypeHierarchy > types DEFAULT_TYPES
variable
bool waitForMessage
class
dai::Node::InputMap
variable
std::string name
function
InputMap(Node & parent, InputDescription defaultInput)
function
InputMap(Node & parent, std::string name, InputDescription defaultInput)
function
Input & operator[](const std::string & key)
function
Input & operator[](std::pair< std::string, std::string > groupKey)
function
bool has(const std::string & key)
class
dai::Node::Output
function
~Output()
inline function
Output(Node & par, OutputDescription desc, bool ref)
inline function
Node & getParent()
inline function
const Node & getParent()
function
std::string toString()
inline function
std::string getName()
Get name of the output
inline function
std::string getGroup()
Get group of the output
inline function
void setGroup(std::string group)
Set group name for this output
inline function
void setName(std::string name)
Set name for this output
inline function
Type getType()
Get type of the output
function
std::vector< DatatypeHierarchy > getPossibleDatatypes()
Get possible datatypes that can be sent
function
void setPossibleDatatypes(std::vector< DatatypeHierarchy > types)
Set possible datatypes that can be sent
function
bool isSamePipeline(const Input & in)
Check if this output and given input are on the same pipeline.
Parameters
canConnect for checking if connection is possible
Returns
True if output and input are on the same pipeline
function
bool canConnect(const Input & in)
Check if connection is possible
Parameters
- in: Input to connect to
Returns
True if connection is possible, false otherwise
function
std::vector< ConnectionInternal > getConnections()
Retrieve all connections from this output
Returns
Vector of connections
inline function
std::vector< QueueConnection > getQueueConnections()
Retrieve all queue connections from this output
Returns
Vector of queue connections
function
std::shared_ptr< dai::MessageQueue > createOutputQueue(unsigned int maxSize, bool blocking)
function
void link(Input & in)
Link current output to input.Throws an error if this output cannot be linked to given input, or if they are already linked
Parameters
- in: Input to link to
function
void link(std::shared_ptr< Node > in)
function
void unlink(Input & in)
Unlink a previously linked connectionThrows an error if not linked.
Parameters
- in: Input from which to unlink from
function
void send(const std::shared_ptr< ADatatype > & msg)
Sends a Message to all connected inputs
Parameters
- msg: Message to send to all connected inputs
function
bool trySend(const std::shared_ptr< ADatatype > & msg)
Try sending a message to all connected inputs
Parameters
- msg: Message to send to all connected inputs
Returns
True if ALL connected inputs got the message, false otherwise
struct
dai::Node::Output::QueueConnection
variable
Output * output
variable
std::shared_ptr< MessageQueue > queue
inline function
bool operator==(const QueueConnection & rhs)
enum
Type
enumerator
MSender
enumerator
SSender
struct
dai::Node::OutputDescription
variable
std::string name
variable
std::string group
variable
std::vector< DatatypeHierarchy > types DEFAULT_TYPES
class
dai::Node::OutputMap
variable
std::string name
function
OutputMap(Node & parent, std::string name, OutputDescription defaultOutput, bool ref)
function
OutputMap(Node & parent, OutputDescription defaultOutput, bool ref)
function
Output & operator[](const std::string & key)
function
Output & operator[](std::pair< std::string, std::string > groupKey)
struct
dai::Node::PairHash
inline function
std::size_t operator()(const std::pair< T1, T2 > & pair)
enum