fix(viz): wire arkit-full + osc port via config
renderer.py: read ARKIT_FULL_SKELETON via VizConfig at initWithState_ instead of module-level os.environ; store as self._arkit_full, use getattr fallback for __new__ test bypass. main.py: pass cfg.iphone_osc_port to IphoneOSCListener instead of hardcoded 57128; log actual port. hand_slots.py: import _finite/_coord/_clamp from hand_features at module level (acyclic: hand_features imports hand_slots only lazily inside step()); delete the duplicate copies.
This commit is contained in:
@@ -20,24 +20,9 @@ from __future__ import annotations
|
||||
|
||||
import math
|
||||
|
||||
|
||||
# ---- micro-helpers (duplicated from hand_features to avoid circular import) ---
|
||||
|
||||
def _finite(v: float, fallback: float) -> float:
|
||||
return v if isinstance(v, float) and math.isfinite(v) else fallback
|
||||
|
||||
|
||||
def _coord(p, attr: str, idx: int, fallback: float = 0.5) -> float:
|
||||
if hasattr(p, attr):
|
||||
return float(getattr(p, attr))
|
||||
try:
|
||||
return float(p[idx])
|
||||
except (TypeError, IndexError):
|
||||
return fallback
|
||||
|
||||
|
||||
def _clamp(v: float, lo: float, hi: float) -> float:
|
||||
return lo if v < lo else hi if v > hi else v
|
||||
# ---- micro-helpers imported from hand_features (acyclic: hand_features only
|
||||
# imports hand_slots lazily inside step(), so a top-level import here is safe) ---
|
||||
from .hand_features import _finite, _coord, _clamp
|
||||
|
||||
|
||||
def _hand_size(hand) -> float:
|
||||
|
||||
@@ -281,9 +281,9 @@ class AppDelegate(NSObject):
|
||||
# stage no-ops. Activated via POSE_FILTER=...+arkit_fuse.
|
||||
try:
|
||||
from .iphone_osc_listener import IphoneOSCListener
|
||||
self._iphone_osc = IphoneOSCListener(self._state)
|
||||
self._iphone_osc = IphoneOSCListener(self._state, port=_cfg.iphone_osc_port)
|
||||
self._iphone_osc.start()
|
||||
LOG.info("worker: + iPhone OSC listener :57128")
|
||||
LOG.info("worker: + iPhone OSC listener :%d", _cfg.iphone_osc_port)
|
||||
except Exception as e: # noqa: BLE001
|
||||
LOG.warning("iphone OSC listener start failed (%s)", e)
|
||||
# ICP LiDAR fusion (opt-in via ICP_FUSION=1). Parallel to the
|
||||
|
||||
@@ -169,6 +169,7 @@ class MetalRenderer(NSObject):
|
||||
# Chirality validated correct live 2026-07-02; keep False unless a
|
||||
# future iPhone app build flips it.
|
||||
self._hand_swap_lr = _cfg.hand_swap_lr
|
||||
self._arkit_full = _cfg.arkit_full_skeleton
|
||||
self._init_skel_cpu_buffer()
|
||||
self._init_mesh_cpu_buffer()
|
||||
self._build_pipelines()
|
||||
@@ -339,7 +340,7 @@ class MetalRenderer(NSObject):
|
||||
Priorise MediaPipe (body 33 + face 478 + 2 mains 21) si disponible
|
||||
et present ; sinon fallback COCO 17 keypoints YOLO."""
|
||||
_arkit_now = time.perf_counter()
|
||||
use_arkit = (ARKIT_FULL and bool(s.arkit_parents)
|
||||
use_arkit = (getattr(self, '_arkit_full', ARKIT_FULL) and bool(s.arkit_parents)
|
||||
and arkit_2d_fresh(s.persons_arkit_2d_t, _arkit_now))
|
||||
if not use_arkit and not s.pose_alive():
|
||||
return 0
|
||||
|
||||
Reference in New Issue
Block a user