Initial commit: RealSense D435 API server
Drop-in replacement for the Nuwa-HP60C camera container, exposing RGB +
aligned depth + intrinsics via REST/WebSocket so the existing
pestello-pose-detector pipeline can consume frames without changes.
Key adaptations for D4xx on USB 2.0 (this robot has no USB 3 port exposed
externally — see STATUS.md):
- pyrealsense2 built from source; the librealsense v2.55.1 install rule
doesn't ship the main .so, so we copy it from the build dir and add an
__init__.py that re-exports the submodule.
- Color stream uses YUYV format on USB 2.x (BGR8/RGB8 time out on this
bus); converted to BGR via cv2.cvtColor in capture().
- rs.align is skipped on USB 2 (incompatible with YUYV); color is
cv2-resized to depth shape for approximate per-pixel alignment.
- Driver auto-detects usb_type_descriptor and falls back to the
full-resolution BGR8 + rs.align pipeline when on USB 3.
Tested: /api/{health,status,discover,rgb,depth,depth/color,capture,
intrinsics} all return 200 with valid payloads at 640x480.
This commit is contained in:
commit
07d95792e3
58 files changed
+6987
No files matched your search
@@ -0,0 +1,51 @@
|
||||
from pydantic_settings import BaseSettings
|
||||
|
||||
|
||||
class Settings(BaseSettings):
|
||||
# Server
|
||||
api_host: str = "0.0.0.0"
|
||||
api_port: int = 8878
|
||||
|
||||
# NATS
|
||||
nats_url: str = "nats://nats:4222"
|
||||
nats_token: str = ""
|
||||
|
||||
# Service identity
|
||||
service_name: str = "realsense-d435"
|
||||
service_domain: str = "vision"
|
||||
|
||||
# Security
|
||||
api_key: str = ""
|
||||
|
||||
# Storage
|
||||
images_dir: str = "/app/images"
|
||||
|
||||
# RealSense stream config
|
||||
camera_width: int = 640
|
||||
camera_height: int = 480
|
||||
camera_fps: int = 30
|
||||
camera_auto_open: bool = True
|
||||
|
||||
# YOLO detector (optional — disabled if model file or onnxruntime missing)
|
||||
yolo_onnx_path: str = "/app/models/best.onnx"
|
||||
yolo_classes: str = ""
|
||||
yolo_conf_default: float = 0.5
|
||||
|
||||
@property
|
||||
def yolo_class_list(self) -> list[str]:
|
||||
return [s.strip() for s in self.yolo_classes.split(",") if s.strip()]
|
||||
|
||||
# CORS (comma-separated string, parsed into list)
|
||||
cors_origins: str = "http://localhost:5173,http://localhost,http://localhost:80"
|
||||
|
||||
@property
|
||||
def cors_origins_list(self) -> list[str]:
|
||||
return [s.strip() for s in self.cors_origins.split(",")]
|
||||
|
||||
model_config = {
|
||||
"env_file": ".env",
|
||||
"env_file_encoding": "utf-8",
|
||||
}
|
||||
|
||||
|
||||
settings = Settings()
|
||||
Reference in new issue
Block a user