Skip to content

Queue classes missing method 'addCallback' in on-device interpreter (Script node) #585

Open
@filiphhh

Description

@filiphhh

Hello!

I am trying to use queue callbacks for simpler message handling when passing data between my OAK-D and host and noticed it seems to be missing from the on-device depthai module.

Sample code:

import depthai
import time

pipeline = depthai.Pipeline()

xin = pipeline.create(depthai.node.XLinkIn)
xin.setStreamName('in')

script = pipeline.create(depthai.node.Script)
xin.out.link(script.inputs['in'])
script.setScript("""
    import time

    def test(frame):
        node.warn("Test")

    node.io['in'].addCallback(test)

    while True:
        time.sleep(1)
""")

xout = pipeline.create(depthai.node.XLinkOut)
xout.setStreamName('script')
script.outputs['out'].link(xout.input)

with depthai.Device(pipeline) as device:
    while True:
        buffer = depthai.Buffer()
        device.getInputQueue('in').send(buffer)
        time.sleep(1)

Output:

[Script(2)] [critical] AttributeError: 'lpb.DataOutputQueue' object has no attribute 'addCallback'

Expected output:

[Script(2)] [warning] Test
[Script(2)] [warning] Test
[Script(2)] [warning] Test
...

I would like to avoid using a series tryGets within the script node while loop like in the gen2-age-gender experiment just to be able to match inputs with their respective functions and outputs.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions