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
Open
fix(feetech_depthai): port Perception.open to the depthai v2 API (fixes no_backend on depthai-2.x rigs)#94craigm26 wants to merge 1 commit into
craigm26 wants to merge 1 commit into
Conversation
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>
There was a problem hiding this comment.
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()usingColorCamera,MonoCamera,StereoDepth, andXLinkOutnodes. - Opens the pipeline via
dai.Device(pipeline)and retrieves host queues withgetOutputQueue. - 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) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
On a robot running depthai 2.x, the
feetech_depthaibackend fails to initialize and everyvision_find/execute_capability/calibratecall degrades tono_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-depthaiextra pinsdepthai>=2.24, while core pinsdepthai>=3.0— so a user who installs the extra and gets a 2.x wheel hitsno_backendon 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 aColorCamera(CAM_A) + aMonoCamerapair (CAM_B/CAM_C) feeding aStereoDepthnodesetDepthAlign(CameraBoardSocket.CAM_A)+setOutputSize(1280, 720)dai.Device(pipeline).__enter__()+getOutputQueue("rgb"/"depth")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_findreturns clean red-object detections through the patched backend (previouslyno_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 thefeetech-depthaiextra currently targets.