feat(right_arm): endpoint /snapshot/{front,wrist}

This commit is contained in:
Adriano Dal Pastro committed 2026-05-20 12:16:33 +02:00
1 parent dd2053cc47
commit 22e13435b1
2 files changed
+52

No files matched your search

+19
View File
@@ -4,6 +4,7 @@ from __future__ import annotations
from typing import Any
from fastapi import APIRouter, HTTPException
from fastapi.responses import Response
from ..clients import G1Unavailable
from ..config import update_config
@@ -54,3 +55,21 @@ def post_activate() -> dict[str, Any]:
return _state_payload(sw)
except G1Unavailable as e:
raise HTTPException(status_code=502, detail=str(e))
@router.get("/snapshot/front")
def snapshot_front() -> Response:
try:
jpeg = _deps.front_camera().rgb_jpeg()
except Exception as e:
raise HTTPException(status_code=502, detail=f"front_camera unreachable: {e}")
return Response(content=jpeg, media_type="image/jpeg")
@router.get("/snapshot/wrist")
def snapshot_wrist() -> Response:
try:
jpeg = _deps.nuwa().rgb_jpeg()
except Exception as e:
raise HTTPException(status_code=502, detail=f"wrist nuwa unreachable: {e}")
return Response(content=jpeg, media_type="image/jpeg")