Files
StarPilot/starpilot/common/vision_bsm.py
T
firestar5683 b945d4c021 Add vision adjacent spot monitoring
Integrate V-ASM from PR #75 with Galaxy-only configuration, stale-state safety, conditional SLV coexistence, and OpenCV inference.

Originally contributed by @prabhaavp in #75.

Co-authored-by: Prabhaav Pillai <143428353+prabhaavp@users.noreply.github.com>
2026-07-23 00:05:43 -05:00

23 lines
723 B
Python

from __future__ import annotations
import time
VASM_STATE_TIMEOUT_SECONDS = 3.0
def get_fresh_vasm_state(params_memory, now: float | None = None) -> tuple[bool, bool]:
"""Return V-ASM state only while the vision daemon is updating it."""
try:
updated_at = float(params_memory.get("VASMLastUpdateMonoTime") or 0)
except (TypeError, ValueError):
return False, False
current_time = time.monotonic() if now is None else now
age = current_time - updated_at
if updated_at <= 0 or age < 0 or age > VASM_STATE_TIMEOUT_SECONDS:
return False, False
active_values = ("1", b"1", True)
return params_memory.get("VASMLeftActive") in active_values, params_memory.get("VASMRightActive") in active_values