From 0717f06f557c1bb69f3cf98cef88ef0fc9a4f0d3 Mon Sep 17 00:00:00 2001 From: Hari495 Date: Tue, 3 Feb 2026 18:57:43 -0500 Subject: [PATCH 1/3] Implemented stereo depth node with RGB alignment --- modules/target_tracking/stereo_node.py | 49 ++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 modules/target_tracking/stereo_node.py diff --git a/modules/target_tracking/stereo_node.py b/modules/target_tracking/stereo_node.py new file mode 100644 index 0000000..20b1660 --- /dev/null +++ b/modules/target_tracking/stereo_node.py @@ -0,0 +1,49 @@ +""" +Module for initializing and configuring the StereoDepth node. +This setup aligns the depth map to the RGB camera for spatial logic. +""" + +import depthai as dai + + +def create_stereo_depth(pipeline: dai.Pipeline) -> dai.node.StereoDepth: + """ + Creates the StereoDepth node and links it to the Mono cameras. + + Args: + pipeline (dai.Pipeline): The DepthAI pipeline object. + + Returns: + dai.node.StereoDepth: The configured stereo node. + """ + # --- 1. Define Sources --- + mono_left = pipeline.create(dai.node.MonoCamera) + mono_right = pipeline.create(dai.node.MonoCamera) + + # Configure the hardware sockets (Left vs Right) + mono_left.setBoardSocket(dai.CameraBoardSocket.LEFT) + mono_right.setBoardSocket(dai.CameraBoardSocket.RIGHT) + + # Set Resolution (400p is standard) + # Breaking line to satisfy flake8 line length limit + mono_left.setResolution(dai.MonoCameraProperties.SensorResolution.THE_400_P) + mono_right.setResolution(dai.MonoCameraProperties.SensorResolution.THE_400_P) + + # --- 2. Define the Processor --- + stereo = pipeline.create(dai.node.StereoDepth) + + # --- 3. Configuration --- + # CRITICAL: Align depth to RGB (bc mono cams are 20 pixels off) + stereo.setDepthAlign(dai.CameraBoardSocket.RGB) + + # Improve quality + stereo.setSubpixel(True) + stereo.setLeftRightCheck(True) # Removes ghost pixels at edges + # Change to True if <50cm need tracking needed + stereo.setExtendedDisparity(False) + + # --- 4. Linking --- + mono_left.out.link(stereo.left) + mono_right.out.link(stereo.right) + + return stereo From eeb9f5910cdd6dd71831bd1e3e25ee8fa8c04eb3 Mon Sep 17 00:00:00 2001 From: Hari495 Date: Tue, 3 Feb 2026 19:11:41 -0500 Subject: [PATCH 2/3] created pytorch-req's file --- requirements-pytorch.txt | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 requirements-pytorch.txt diff --git a/requirements-pytorch.txt b/requirements-pytorch.txt new file mode 100644 index 0000000..b805223 --- /dev/null +++ b/requirements-pytorch.txt @@ -0,0 +1,4 @@ +# Runtime dependencies for target tracking pipeline + +depthai>=2.24.0 +pymavlink>=2.4.40 \ No newline at end of file From 9b690779c24f17523afa5105b7465cbd47fd2c61 Mon Sep 17 00:00:00 2001 From: Hari495 Date: Tue, 3 Feb 2026 19:14:02 -0500 Subject: [PATCH 3/3] ran linters --- main_2025.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main_2025.py b/main_2025.py index 6892e70..1b7c348 100644 --- a/main_2025.py +++ b/main_2025.py @@ -1,8 +1,8 @@ """ for target tracking """ -import pathlib +import pathlib CONFIG_FILE_PATH = pathlib.Path("config.yaml")