feat(deps): aggiungi front_camera() e tab_right_arm_cfg()

This commit is contained in:
Adriano Dal Pastro committed 2026-05-20 12:07:11 +02:00
1 parent 04cc5fc345
commit 757eb01200
2 files changed
+34

No files matched your search

+11
View File
@@ -26,6 +26,12 @@ def nuwa() -> NuwaClient:
return NuwaClient(c["base_url"], timeout_s=c.get("timeout_s", 5.0), api_key=c.get("api_key"))
def front_camera() -> NuwaClient:
"""Camera depth montata sulla fronte del robot (servizio Nuwa-like in docker)."""
c = _svc(get_config(), "front_camera")
return NuwaClient(c["base_url"], timeout_s=c.get("timeout_s", 5.0))
def marker() -> MarkerClient:
c = _svc(get_config(), "marker_finder")
return MarkerClient(c["base_url"], timeout_s=c.get("timeout_s", 5.0))
@@ -132,3 +138,8 @@ def samples_file_path(side: str | None = None) -> Path:
def depth_correction_path() -> Path:
"""Where the depth-bias correction state (params + samples) is persisted."""
return data_dir() / "depth_correction.json"
def tab_right_arm_cfg() -> dict[str, Any]:
"""Blocco di config per la tab Braccio DX. Restituisce {} se mancante."""
return get_config().get("tab_right_arm", {}) or {}
+23
View File
@@ -0,0 +1,23 @@
"""Verifica che _deps esponga front_camera() e tab_right_arm_cfg()."""
from __future__ import annotations
from presa_mano.api import _deps
from presa_mano.clients import NuwaClient
def test_front_camera_returns_nuwa_client_with_config_base_url():
cam = _deps.front_camera()
assert isinstance(cam, NuwaClient)
# base_url da config.yaml (stripped della trailing slash dal client)
assert cam.base_url.startswith("http")
# Deve essere DIVERSO dall'URL della nuwa principale
assert cam.base_url != _deps.nuwa().base_url
def test_tab_right_arm_cfg_returns_dict_with_required_keys():
cfg = _deps.tab_right_arm_cfg()
assert cfg["yolo_class"] == "pestello"
for key in ("yolo_conf_front", "yolo_conf_wrist", "move_offset_camera_mm",
"axis_sign_cam_to_wrist", "max_step_m", "z_floor_m",
"home_pose", "custom_pose"):
assert key in cfg