File tree Expand file tree Collapse file tree 2 files changed +43
-1
lines changed
Expand file tree Collapse file tree 2 files changed +43
-1
lines changed Original file line number Diff line number Diff line change 1+ #!/usr/bin/env python3
2+ import depthai as dai
3+ import time
4+
5+ # Start defining a pipeline
6+ pipeline = dai .Pipeline ()
7+
8+ # Script node
9+ script = pipeline .create (dai .node .Script )
10+ script .setScript ("""
11+ from datetime import timedelta
12+ while True:
13+ node.warn("Waiting for message")
14+ message = node.inputs['test'].get(timedelta(milliseconds=500))
15+ # message = node.inputs['test'].get()
16+ if message is None:
17+ node.warn("Timeout")
18+ continue
19+ node.warn("Received message")
20+ buf = NNData(150)
21+ node.outputs['host'].send(buf)
22+ """ )
23+
24+ # XLinkOut
25+ xout = pipeline .create (dai .node .XLinkOut )
26+ xout .setStreamName ('host' )
27+ script .outputs ['host' ].link (xout .input )
28+
29+ # XLinkIn
30+ xin = pipeline .create (dai .node .XLinkIn )
31+ xin .setStreamName ('test' )
32+ xin .out .link (script .inputs ['test' ])
33+
34+ # Connect to device with pipeline
35+ with dai .Device (pipeline ) as device :
36+ device .setLogLevel (dai .LogLevel .WARN )
37+ device .setLogOutputLevel (dai .LogLevel .WARN )
38+ inp = device .getInputQueue ("test" )
39+ inp .send (dai .NNData ())
40+ nndata = device .getOutputQueue ("host" ).get ()
41+ print ("Host received NNData" )
42+ time .sleep (30 )
You can’t perform that action at this time.
0 commit comments