Install (or rebuild) the bundled sensing backend in the background.
()
| 1658 | return [{'x': p['x'] + (cx - p['x']) * frac, 'y': p['y'] + (cy - p['y']) * frac} |
| 1659 | for p in poly] |
| 1660 | |
| 1661 | |
| 1662 | def _rusense_geofence_verdict(positions, windows): |
| 1663 | """Port of evaluateGeofence(). positions={id:{x,y,z}}, windows={id:[rssi…]}. |
| 1664 | Returns a dict incl. ok, energetic, corroborated, interior, inside_perimeter, |
| 1665 | reason, hot_count, total. ok=False when fewer than 3 corners are mapped.""" |
| 1666 | nodes = [] |
| 1667 | for nid, pos in (positions or {}).items(): |
| 1668 | if not isinstance(pos, dict) or not _gf_finite(pos.get('x')) or not _gf_finite(pos.get('y')): |
| 1669 | continue |
| 1670 | win = windows.get(str(nid)) or [] |
| 1671 | disturbance = 1.0 - math.exp(-_gf_std(win) / (_GF_DBM_SCALE or 1e-9)) |
| 1672 | nodes.append({'id': str(nid), 'x': float(pos['x']), 'y': float(pos['y']), |
| 1673 | 'disturbance': disturbance, 'hot': disturbance >= _GF_HOT_THRESHOLD}) |
| 1674 | if len(nodes) < 3: |
| 1675 | return {'ok': False, 'reason': 'need >=3 mapped node corners', 'inside_perimeter': False, |