Skip to content

fix(feetech_depthai): port Perception.open to the depthai v2 API (fixes no_backend on depthai-2.x rigs)#94

Open
craigm26 wants to merge 1 commit into
mainfrom
fix/depthai-v2-feetech-perception
Open

fix(feetech_depthai): port Perception.open to the depthai v2 API (fixes no_backend on depthai-2.x rigs)#94
craigm26 wants to merge 1 commit into
mainfrom
fix/depthai-v2-feetech-perception

Conversation

@craigm26
Copy link
Copy Markdown
Contributor

Problem

On a robot running depthai 2.x, the feetech_depthai backend fails to initialize and every vision_find / execute_capability / calibrate call degrades to no_backend.

Root cause: Perception.open() is written against the depthai v3 pipeline API — dai.node.Camera().build(...), StereoDepth.setDefaultProfilePreset(PresetMode...), requestOutput(...), createOutputQueue(...), pipeline.start(). Those calls raise on the 2.x line, so the perception object never opens and backend resolution returns nothing.

This bites the supported configuration: the feetech-depthai extra pins depthai>=2.24, while core pins depthai>=3.0 — so a user who installs the extra and gets a 2.x wheel hits no_backend on every depthai call.

Fix

Port Perception.open() to the depthai v2 pipeline API (one file, cli/src/robot_md/backends/feetech_depthai/perception.py):

  • dai.Pipeline() with a ColorCamera (CAM_A) + a MonoCamera pair (CAM_B/CAM_C) feeding a StereoDepth node
  • depth aligned to the RGB socket via setDepthAlign(CameraBoardSocket.CAM_A) + setOutputSize(1280, 720)
  • dai.Device(pipeline).__enter__() + getOutputQueue("rgb"/"depth")
  • intrinsics read via readCalibration().getCameraIntrinsics(CAM_A, 1280, 720)

No public API or behavior change — the backend produces the same aligned (rgb, depth, K) tuple; only the pipeline construction is adapted to 2.x.

Verification

Tested live on a Raspberry Pi with depthai 2.32 + OAK-D-Lite: aligned 720×1280 depth, factory intrinsics resolved, and vision_find returns clean red-object detections through the patched backend (previously no_backend).

Scope

Single file, +37/−33. Does not touch the v3 code path conceptually — if the project wants to support both, a follow-up could branch on depthai.__version__; this PR restores the 2.x line to working order, which is what the feetech-depthai extra currently targets.

robot-md 1.10.3 ships a depthai-v3 camera pipeline (Pipeline ctx-manager,
node.Camera().build(), requestOutput, createOutputQueue, pipe.start) but the
ecosystem runs depthai 2.x. The v3 calls raise on 2.x so the backend degrades
to no_backend on every depthai-2.x rig, breaking vision_find / execute_capability
/ calibrate. Ported open() to the v2 pattern (ColorCamera + MonoCamera pair +
StereoDepth aligned to CAM_A at RGB res + Device(pipeline) + getOutputQueue),
mirroring oak_d_actuator. Verified live: aligned depth 720x1280, factory
intrinsics, clean red-lego detection on the OAK-D-Lite.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings May 29, 2026 20:34
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR ports the feetech_depthai perception pipeline from DepthAI v3-style APIs to DepthAI v2 APIs so supported DepthAI 2.x installations can initialize the backend instead of losing perception support.

Changes:

  • Rebuilds Perception.open() using ColorCamera, MonoCamera, StereoDepth, and XLinkOut nodes.
  • Opens the pipeline via dai.Device(pipeline) and retrieves host queues with getOutputQueue.
  • Reads RGB camera intrinsics from the active device for aligned RGB/depth back-projection.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +88 to 94
self._pipe = dai.Device(pipeline).__enter__()
self._rgb_q = self._pipe.getOutputQueue("rgb", maxSize=4, blocking=False)
self._depth_q = self._pipe.getOutputQueue("depth", maxSize=4, blocking=False)

calib = self._pipe.readCalibration()
mat = calib.getCameraIntrinsics(dai.CameraBoardSocket.CAM_A, self._rgb_w, self._rgb_h)
self.K = np.array(mat, dtype=np.float64)
Comment on lines +88 to +90
self._pipe = dai.Device(pipeline).__enter__()
self._rgb_q = self._pipe.getOutputQueue("rgb", maxSize=4, blocking=False)
self._depth_q = self._pipe.getOutputQueue("depth", maxSize=4, blocking=False)
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.

2 participants