ON THIS PAGE

  • Gate
  • How to place it
  • Inputs and Outputs
  • Usage
  • Examples of functionality
  • Reference

Gate

Supported on:RVC2RVC4
Enables opening and closing a message stream at runtime.

How to place it

Python
C++

Python

Python
1with dai.Pipeline() as pipeline:
2    gate  = pipeline.create(dai.node.Gate)

Inputs and Outputs

Usage

Python
C++

Python

Python
1with dai.Pipeline(device) as pipeline:
2    camera = pipeline.create(dai.node.Camera).build()
3    cameraOut = camera.requestOutput((640, 400), fps=30)
4
5    gate  = pipeline.create(dai.node.Gate)
6    cameraOut.link(gate.input)
7    cameraQueue = gate.output.createOutputQueue()
8    gateControlQueue = gate.inputControl.createInputQueue()
9
10    gateControl = dai.GateControl()
11
12    pipeline.start()
13
14    startTime = time.monotonic()
15    gateOpen = True
16
17    # Open gate every odd second and close every even second
18    while pipeline.isRunning():
19        currentTime = time.monotonic()
20        if (startTime-currentTime) % 2 == 0: 
21            if not gateOpen:
22                gateControlQueue.send(dai.GateControl.openGate())
23                openGate = True
24        else: 
25            if gateOpen:
26                gateControlQueue.send(dai.GateControl.closeGate())
27                gateOpen = False

Examples of functionality

Reference

class

dai::node::Gate

#include Gate.hpp
variable
std::shared_ptr< GateControl > initialConfig
variable
Input input
variable
Output output
variable
Input inputControl
function
Gate(std::unique_ptr< Properties > props)
function
Gate()
function
void setRunOnHost(bool runOnHost)
Specify whether to run on host or device By default, the node will run on device.
function
bool runOnHost()
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.