diff --git a/config.yaml b/config.yaml index 8b21fd7..3e97770 100644 --- a/config.yaml +++ b/config.yaml @@ -17,6 +17,9 @@ services: base_url: http://localhost:8767 timeout_s: 5.0 write_timeout_s: 30.0 + sam21: + base_url: http://localhost:8002 + timeout_s: 10.0 aruco: dictionary: DICT_4X4_50 wrist_marker: @@ -31,6 +34,7 @@ grasp: max_object_width_m: 0.08 pointcloud_step: 1 pointcloud_max_depth_mm: 2000 + use_sam21: true visual_servo: min_distance_m: 0.1 step_fraction: 0.5 diff --git a/src/presa_mano/api/_deps.py b/src/presa_mano/api/_deps.py index ee0d28b..a894593 100644 --- a/src/presa_mano/api/_deps.py +++ b/src/presa_mano/api/_deps.py @@ -6,7 +6,7 @@ from __future__ import annotations from pathlib import Path 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 @@ -29,6 +29,14 @@ def yolo() -> YoloClient: 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: """Which robot the orchestrator is currently bound to ('g1' or 'h1'). Read from `robot.active` in config; defaults to 'g1' for backward compat.""" diff --git a/src/presa_mano/clients/__init__.py b/src/presa_mano/clients/__init__.py index f686fef..4c4dd3a 100644 --- a/src/presa_mano/clients/__init__.py +++ b/src/presa_mano/clients/__init__.py @@ -3,9 +3,12 @@ from .g1 import G1Client, G1StatusError, G1Unavailable from .marker import MarkerClient from .nuwa import NuwaClient, NuwaError +from .sam21 import Sam21Client, Sam21Error, Sam21Unavailable from .yolo import YoloClient __all__ = [ "G1Client", "G1StatusError", "G1Unavailable", - "MarkerClient", "NuwaClient", "NuwaError", "YoloClient", + "MarkerClient", "NuwaClient", "NuwaError", + "Sam21Client", "Sam21Error", "Sam21Unavailable", + "YoloClient", ]