physicalai-runtime-adding-a-camera-backend
Adds or modifies a camera backend under physicalai.capture. Use when implementing a new Camera type, extending create_camera in src/physicalai/capture/factory.py, discovery helpers, optional pip extras for vendor SDKs, SharedCamera transport, or tests under tests/unit/capture with fake devices.
How do I install this agent skill?
npx skills add https://github.com/openvinotoolkit/physicalai --skill physicalai-runtime-adding-a-camera-backendIs this agent skill safe to install?
- Gen Agent Trust Hubpass
The skill provides architectural guidance and workflow instructions for adding new camera backends to the physicalai project. It contains standard development practices and no security threats.
- Socketpass
No alerts
- Snykpass
Risk: LOW · No issues
What does this agent skill do?
Adding a Camera Backend
Cameras implement the Camera interface in src/physicalai/capture/camera.py. Factory entry: create_camera() in src/physicalai/capture/factory.py maps lowercase type names (uvc, realsense, basler, …) to implementations. Reference layouts: src/physicalai/capture/cameras/uvc/, src/physicalai/capture/cameras/realsense/, src/physicalai/capture/cameras/basler/.
Workflow
- Pick a reference backend closest to the new hardware (UVC for USB video, RealSense for RGB-D, Basler for GenICam industrial).
- Done when: you can list which modules to mirror (
_camera.py,_discover.py,__init__.pyexports).
- Done when: you can list which modules to mirror (
- Implement
Camera:connect(),disconnect(),read()/read_latest(), context manager support, monotonic timestamps onFrame(src/physicalai/capture/frame.py).- Done when: fake or mocked device tests can exercise connect/read without hardware.
- Wire discovery if the device is enumerable — add helpers under
src/physicalai/capture/discovery.pyor backend-specific_discover.py. - Register the type in
src/physicalai/capture/factory.pyand export public class fromsrc/physicalai/capture/__init__.pywhen user-facing. - Optional extra in
pyproject.tomlfor vendor SDKs; lazy-import inside the camera module sopip install physicalaistays light.- Done when:
import physicalai.captureworks without the extra; importing the camera class fails with a clear message if the extra is missing.
- Done when:
- Tests in
tests/unit/capture/using existing fakes (tests/unit/capture/fake.py,conftest.pypatterns).- Done when:
uv run pytest tests/unit/capture -k <backend>passes.
- Done when:
Shared transport
For multi-process access, create_camera(..., shared=True) wraps with SharedCamera (physicalai[capture] / transport extra, iceoryx2). Only document shared mode when the transport extra is installed.
Required checks
CameraTypeor factory string is documented indocs/reference/camera-api.mdwhen user-visible.- Frame shapes and dtypes match README examples (RGB
(H, W, 3)). - No blocking discovery at import time.
Verify
uv run pytest tests/unit/capture -q
prek run --all-files
How can the creator link this skill?
Add the canonical catalog link to the repository README so users can inspect current installs and available audits. The publishing guide covers the complete discovery path.
<a href="https://skillzs.dev/skills/openvinotoolkit/physicalai/physicalai-runtime-adding-a-camera-backend">View physicalai-runtime-adding-a-camera-backend on skillZs</a>