Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added support for setting component output's name #1108

Merged
merged 5 commits into from
Sep 1, 2023

Conversation

Erol444
Copy link
Member

@Erol444 Erol444 commented Sep 1, 2023

Added support for setting component output's name, which will be later used for packet name

Example:

from queue import Empty
from depthai_sdk import OakCamera
from depthai_sdk.classes.packets import FramePacket
from typing import Dict

with OakCamera() as oak:
    color = oak.create_camera('color', fps=32)
    imu = oak.create_imu()

    q2 = oak.queue([color.out.camera.set_name('name123'), imu], max_size=5).configure_syncing(threshold_ms=int((1000/30) / 2)).get_queue()

    # oak.show_graph()
    oak.start()

    while oak.running():
        try:
            packets: Dict[str, FramePacket] = q2.get(block=False)
            print('PACKETS', packets)
            # Both works
            color1 = packets["name123"].get_timestamp()
            color2 = packets[color.out.camera].get_timestamp()

            print('COLOR TS', color1, color2)

            # Both works
            imu1 = packets[imu].get_timestamp()
            # If you pass component to queue, it will take default output, which is out.main
            imu2 = packets[imu.out.main].get_timestamp()

            print('IMU TS', imu1, imu2)
        except Empty:
            pass

Erol444 and others added 4 commits September 1, 2023 15:49
… issues so all examples pass (except custom_action.py)
…ames

# Conflicts:
#	depthai_sdk/src/depthai_sdk/classes/packet_handlers.py
#	depthai_sdk/src/depthai_sdk/components/camera_component.py
#	depthai_sdk/src/depthai_sdk/components/component.py
#	depthai_sdk/src/depthai_sdk/components/imu_component.py
#	depthai_sdk/src/depthai_sdk/components/nn_component.py
#	depthai_sdk/src/depthai_sdk/components/pointcloud_component.py
#	depthai_sdk/src/depthai_sdk/components/stereo_component.py
#	depthai_sdk/src/depthai_sdk/oak_camera.py
#	depthai_sdk/src/depthai_sdk/oak_outputs/xout/xout_base.py
@daniilpastukhov daniilpastukhov merged commit 61999e6 into develop Sep 1, 2023
23 of 29 checks passed
@daniilpastukhov daniilpastukhov deleted the component_output_names branch September 1, 2023 15:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants