new gpr
This commit is contained in:
@@ -399,21 +399,25 @@ class AppWindowPipelineMixin:
|
||||
previous = current
|
||||
time.sleep(poll_s)
|
||||
|
||||
def _drain_results_until_quiet(self, *, timeout_s: float, poll_s: float) -> None:
|
||||
"""Drain only results ring until size stabilizes or timeout expires."""
|
||||
def _drain_results_until_quiet(self, *, timeout_s: float, poll_s: float) -> ResultCollection | None:
|
||||
"""Drain results until at least one result arrives and the ring becomes quiet."""
|
||||
if self._result_reader is None:
|
||||
return
|
||||
return None
|
||||
|
||||
deadline = time.monotonic() + timeout_s
|
||||
stable_rounds = 0
|
||||
latest_seen: ResultCollection | None = None
|
||||
|
||||
while time.monotonic() < deadline and stable_rounds < 2:
|
||||
while time.monotonic() < deadline and (latest_seen is None or stable_rounds < 2):
|
||||
latest = self._read_all_results()
|
||||
if latest is None:
|
||||
stable_rounds += 1
|
||||
if latest_seen is not None:
|
||||
stable_rounds += 1
|
||||
else:
|
||||
latest_seen = latest
|
||||
stable_rounds = 0
|
||||
time.sleep(poll_s)
|
||||
return latest_seen
|
||||
|
||||
def _update_history_indicator(self) -> None:
|
||||
"""Update UI label with current history buffer sizes."""
|
||||
@@ -466,22 +470,25 @@ class AppWindowPipelineMixin:
|
||||
)
|
||||
|
||||
def _drain_locator_speed_updates(self) -> None:
|
||||
"""Apply queued speed updates received by the embedded locator server."""
|
||||
latest_speed = self._locator_service.drain_speed_updates()
|
||||
if latest_speed is None:
|
||||
"""Drain queued locator speed packets; coherent BP does not use motion speed."""
|
||||
if self._locator_service is None:
|
||||
return
|
||||
self._apply_external_gpr_speed_update(0.0) # TODO: remove temporary stub and apply real locator client speed.
|
||||
self._locator_service.drain_speed_updates()
|
||||
|
||||
def _publish_locator_snapshot_from_collection(self, collection: ResultCollection) -> None:
|
||||
"""Publish one locator snapshot from a GPR result collection."""
|
||||
if self._locator_service is None:
|
||||
return
|
||||
self._locator_service.publish_collection(
|
||||
collection,
|
||||
float(self._gpr_min_visible_pair_count.value()),
|
||||
float(self._gpr_min_visible_score.value()),
|
||||
visible_bounds=self._gpr_visible_object_bounds(),
|
||||
)
|
||||
|
||||
def _publish_locator_snapshot_from_latest_result(self) -> None:
|
||||
"""Publish current locator-visible snapshot from latest cached GPR result."""
|
||||
if self._locator_service is None:
|
||||
return
|
||||
if self._processing_mode.currentText() != "gpr":
|
||||
self._locator_service.publish_empty()
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user