IQ.Pilot Release Commit @ d23c019
This commit is contained in:
@@ -214,9 +214,10 @@ class NoEntryCard(AlertCard):
|
||||
def __init__(self,
|
||||
alert_text_2: str,
|
||||
alert_text_1: str = "openpilot Unavailable",
|
||||
visual_alert: car.CarControl.HUDControl.VisualAlert = VisualAlert.none):
|
||||
visual_alert: car.CarControl.HUDControl.VisualAlert = VisualAlert.none,
|
||||
priority: Tier = Tier.LOW):
|
||||
primary, secondary, size = _mici_reframe(alert_text_1, alert_text_2)
|
||||
super().__init__(primary, secondary, AlertStatus.normal, size, Tier.LOW, visual_alert, AudibleAlert.refuse, 3.0)
|
||||
super().__init__(primary, secondary, AlertStatus.normal, size, priority, visual_alert, AudibleAlert.refuse, 3.0)
|
||||
|
||||
|
||||
class GentleDisableCard(AlertCard):
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 28 KiB |
@@ -1,6 +0,0 @@
|
||||
"""
|
||||
Copyright © IQ.Lvbs, apart of Project Teal Lvbs, All Rights Reserved, licensed under https://konn3kt.com/tos
|
||||
|
||||
Shared speed-limit enums and helpers. The live resolver is IQSpeedLimitResolver
|
||||
in speed_limit_controller.py.
|
||||
"""
|
||||
@@ -95,8 +95,17 @@ _CAMERA_LABELS = {
|
||||
|
||||
def speed_camera_alert(CP: car.CarParams, CS: car.CarState, sm: messaging.SubMaster, metric: bool, soft_disable_time: int, personality) -> Alert:
|
||||
nav = sm['iqNavState']
|
||||
label = _CAMERA_LABELS.get(int(getattr(nav.cameraType, "raw", nav.cameraType)), "Speed Camera")
|
||||
ctype = int(getattr(nav.cameraType, "raw", nav.cameraType))
|
||||
label = _CAMERA_LABELS.get(ctype, "Speed Camera")
|
||||
distance = float(nav.cameraDistance)
|
||||
# RF (BLE/WiFi) Flock detection is a live proximity hit with no meaningful
|
||||
# distance — flockd/navd flag it with distance 0 on the alpr camera type.
|
||||
if ctype == int(custom.IQNavState.CameraType.alpr) and distance <= 0.0:
|
||||
return Alert(
|
||||
"Flock Camera Detected",
|
||||
"",
|
||||
AlertStatus.normal, AlertSize.small,
|
||||
Priority.HIGH, VisualAlert.none, AudibleAlert.prompt, .2)
|
||||
if metric:
|
||||
dist_str = f"{distance:.0f} m" if distance < 1000.0 else f"{distance / 1000.0:.1f} km"
|
||||
else:
|
||||
|
||||
@@ -40,10 +40,21 @@ def _speed_scale() -> float:
|
||||
# Accel strip
|
||||
# ============================================================================
|
||||
_STRIP_WIDTH = 28
|
||||
_STRIP_INSET = 14
|
||||
_STRIP_CEILING = 0.85
|
||||
_STRIP_EMA = 5.0
|
||||
_STRIP_GO = canvas.shade(0, 245, 0, 200)
|
||||
_STRIP_STOP = canvas.shade(245, 0, 0, 200)
|
||||
_STRIP_ARC_SEGMENTS = 24
|
||||
_STRIP_ACCEL = (33, 112, 115)
|
||||
_STRIP_ACCEL_NEON = (94, 232, 236)
|
||||
_STRIP_DECEL = (255, 0, 247)
|
||||
_STRIP_DECEL_NEON = (255, 145, 251)
|
||||
_STRIP_TIP_ALPHA = 235
|
||||
_STRIP_ROOT_ALPHA = 55
|
||||
# neon edge: opaque core inside the cap, then non-overlapping halo bands outside it
|
||||
_STRIP_CORE = 3.0
|
||||
_STRIP_CORE_FLOOR = 0.3
|
||||
_STRIP_HALO = ((3.0, 0.42), (5.0, 0.14))
|
||||
_STRIP_NEON_FULL = 2.0 # m/s^2 at which the edges reach full brightness
|
||||
|
||||
|
||||
class RocketFuel:
|
||||
@@ -54,6 +65,22 @@ class RocketFuel:
|
||||
mag = abs(self._eased)
|
||||
return 0.0 if mag == 0.0 else max(0.0, _STRIP_CEILING - 0.1 / mag)
|
||||
|
||||
@staticmethod
|
||||
def _tint(fill, frac: float):
|
||||
return canvas.shade(*fill, int(_STRIP_TIP_ALPHA + (_STRIP_ROOT_ALPHA - _STRIP_TIP_ALPHA) * frac))
|
||||
|
||||
@staticmethod
|
||||
def _cap(center, cap: float, up: bool, fill, neon, heat: float) -> None:
|
||||
start, end = (180.0, 360.0) if up else (0.0, 180.0)
|
||||
canvas.annulus(center, 0.0, cap, start, end, _STRIP_ARC_SEGMENTS, fill)
|
||||
edge = cap
|
||||
for spread, weight in _STRIP_HALO:
|
||||
canvas.annulus(center, edge, edge + spread, start, end, _STRIP_ARC_SEGMENTS,
|
||||
canvas.shade(*neon, int(255 * heat * weight)))
|
||||
edge += spread
|
||||
core = canvas.shade(*neon, int(255 * (_STRIP_CORE_FLOOR + (1.0 - _STRIP_CORE_FLOOR) * heat)))
|
||||
canvas.annulus(center, max(0.0, cap - _STRIP_CORE), cap, start, end, _STRIP_ARC_SEGMENTS, core)
|
||||
|
||||
def render(self, rect, sm) -> None:
|
||||
if not ui_state.rocket_fuel:
|
||||
return
|
||||
@@ -61,9 +88,20 @@ class RocketFuel:
|
||||
reach = self._reach() * rect.height / 2.0
|
||||
if reach <= 0.0:
|
||||
return
|
||||
accelerating = self._eased > 0.0
|
||||
mid = rect.y + rect.height / 2.0
|
||||
top, tint = (mid - reach, _STRIP_GO) if self._eased > 0.0 else (mid, _STRIP_STOP)
|
||||
canvas.slab(rect.x, top, _STRIP_WIDTH, reach, tint)
|
||||
top = mid - reach if accelerating else mid
|
||||
x = rect.x + _STRIP_INSET
|
||||
cap = min(_STRIP_WIDTH / 2.0, reach / 2.0)
|
||||
fill, neon = (_STRIP_ACCEL, _STRIP_ACCEL_NEON) if accelerating else (_STRIP_DECEL, _STRIP_DECEL_NEON)
|
||||
near = cap / reach
|
||||
frac_top, frac_bottom = (near, 1.0 - near) if accelerating else (1.0 - near, near)
|
||||
heat = min(abs(self._eased) / _STRIP_NEON_FULL, 1.0)
|
||||
|
||||
canvas.v_sweep(x, top + cap, cap * 2.0, reach - cap * 2.0,
|
||||
self._tint(fill, frac_top), self._tint(fill, frac_bottom))
|
||||
self._cap(canvas.Pt(x + cap, top + cap), cap, True, self._tint(fill, frac_top), neon, heat)
|
||||
self._cap(canvas.Pt(x + cap, top + reach - cap), cap, False, self._tint(fill, frac_bottom), neon, heat)
|
||||
|
||||
|
||||
# ============================================================================
|
||||
|
||||
Reference in New Issue
Block a user