feat: wire Sam21Client into _deps and config

Adds services.sam21 (base_url + timeout_s) and grasp.use_sam21 toggle.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Adriano Dal PastroandClaude Opus 4.7 committed 2026-05-11 14:43:18 +02:00
1 parent 0bc1e02f11
commit 748f5f58f7
3 files changed
+17 -2

No files matched your search

+4
View File
@@ -17,6 +17,9 @@ services:
base_url: http://localhost:8767 base_url: http://localhost:8767
timeout_s: 5.0 timeout_s: 5.0
write_timeout_s: 30.0 write_timeout_s: 30.0
sam21:
base_url: http://localhost:8002
timeout_s: 10.0
aruco: aruco:
dictionary: DICT_4X4_50 dictionary: DICT_4X4_50
wrist_marker: wrist_marker:
@@ -31,6 +34,7 @@ grasp:
max_object_width_m: 0.08 max_object_width_m: 0.08
pointcloud_step: 1 pointcloud_step: 1
pointcloud_max_depth_mm: 2000 pointcloud_max_depth_mm: 2000
use_sam21: true
visual_servo: visual_servo:
min_distance_m: 0.1 min_distance_m: 0.1
step_fraction: 0.5 step_fraction: 0.5
+9 -1
View File
@@ -6,7 +6,7 @@ from __future__ import annotations
from pathlib import Path from pathlib import Path
from typing import Any from typing import Any
from ..clients import G1Client, MarkerClient, NuwaClient, YoloClient from ..clients import G1Client, MarkerClient, NuwaClient, Sam21Client, YoloClient
from ..config import data_dir, get_config from ..config import data_dir, get_config
@@ -29,6 +29,14 @@ def yolo() -> YoloClient:
return YoloClient(c["base_url"], timeout_s=c.get("timeout_s", 10.0)) return YoloClient(c["base_url"], timeout_s=c.get("timeout_s", 10.0))
def sam21() -> Sam21Client:
c = _svc(get_config(), "sam21")
return Sam21Client(
base_url=c.get("base_url", "http://localhost:8002"),
timeout_s=float(c.get("timeout_s", 10.0)),
)
def active_robot_key() -> str: def active_robot_key() -> str:
"""Which robot the orchestrator is currently bound to ('g1' or 'h1'). """Which robot the orchestrator is currently bound to ('g1' or 'h1').
Read from `robot.active` in config; defaults to 'g1' for backward compat.""" Read from `robot.active` in config; defaults to 'g1' for backward compat."""
+4 -1
View File
@@ -3,9 +3,12 @@
from .g1 import G1Client, G1StatusError, G1Unavailable from .g1 import G1Client, G1StatusError, G1Unavailable
from .marker import MarkerClient from .marker import MarkerClient
from .nuwa import NuwaClient, NuwaError from .nuwa import NuwaClient, NuwaError
from .sam21 import Sam21Client, Sam21Error, Sam21Unavailable
from .yolo import YoloClient from .yolo import YoloClient
__all__ = [ __all__ = [
"G1Client", "G1StatusError", "G1Unavailable", "G1Client", "G1StatusError", "G1Unavailable",
"MarkerClient", "NuwaClient", "NuwaError", "YoloClient", "MarkerClient", "NuwaClient", "NuwaError",
"Sam21Client", "Sam21Error", "Sam21Unavailable",
"YoloClient",
] ]