From 1cbd666f3236fefbe83ce90d18ada95cd1c33919 Mon Sep 17 00:00:00 2001 From: royjr Date: Wed, 1 Apr 2026 19:58:31 -0400 Subject: [PATCH] better --- selfdrive/selfdrived/events.py | 4 +- .../ui/sunnypilot/mici/onroad/hud_renderer.py | 43 ------------------- 2 files changed, 3 insertions(+), 44 deletions(-) diff --git a/selfdrive/selfdrived/events.py b/selfdrive/selfdrived/events.py index 3e20a28023..987f33ad00 100755 --- a/selfdrive/selfdrived/events.py +++ b/selfdrive/selfdrived/events.py @@ -185,7 +185,9 @@ def modeld_lagging_alert(CP: car.CarParams, CS: car.CarState, sm: messaging.SubM def joystick_alert(CP: car.CarParams, CS: car.CarState, sm: messaging.SubMaster, metric: bool, soft_disable_time: int, personality) -> Alert: gb = sm['carControl'].actuators.accel / 4. steer = sm['carControl'].actuators.torque - vals = f"Gas: {round(gb * 100.)}%, Steer: {round(steer * 100.)}%" + damp = sm['carControl'].actuators.dampFactor + damp_pct = round((damp - 3) / (200 - 3) * 100.) if damp > 0 else 50 + vals = f"Gas: {round(gb * 100.)}%, Steer: {round(steer * 100.)}%\nDamp: {damp_pct}%" return NormalPermanentAlert("Joystick Mode", vals) diff --git a/selfdrive/ui/sunnypilot/mici/onroad/hud_renderer.py b/selfdrive/ui/sunnypilot/mici/onroad/hud_renderer.py index 3f233d7f3a..9d39d01727 100644 --- a/selfdrive/ui/sunnypilot/mici/onroad/hud_renderer.py +++ b/selfdrive/ui/sunnypilot/mici/onroad/hud_renderer.py @@ -6,56 +6,14 @@ See the LICENSE.md file in the root directory for more details. """ import pyray as rl -from openpilot.common.params import Params from openpilot.selfdrive.ui.mici.onroad.hud_renderer import HudRenderer from openpilot.selfdrive.ui.sunnypilot.onroad.blind_spot_indicators import BlindSpotIndicators -from openpilot.selfdrive.ui.ui_state import ui_state -from openpilot.system.ui.lib.application import gui_app, FontWeight - - -class JoystickDebugOverlay: - def __init__(self): - self._params = Params() - self._font = None - - def _ensure_font(self): - if self._font is None: - self._font = gui_app.font(FontWeight.BOLD) - - def render(self, rect: rl.Rectangle) -> None: - if not self._params.get_bool("JoystickDebugMode"): - return - if not ui_state.started: - return - - self._ensure_font() - - actuators = ui_state.sm['carControl'].actuators - accel = actuators.accel - lateral = actuators.torque - damp = actuators.dampFactor if actuators.dampFactor > 0 else 100.0 - - font_size = 48 - line_height = 60 - x = rect.x + rect.width - 300 - y = rect.y + 120 - - labels = [ - ("ACCEL", f"{accel:+.2f}"), - ("LATERAL", f"{lateral:+.2f}"), - ("DAMP", f"{damp:.0f}"), - ] - - for label, value in labels: - rl.draw_text_ex(self._font, f"{label}: {value}", rl.Vector2(x, y), font_size, 0, rl.WHITE) - y += line_height class HudRendererSP(HudRenderer): def __init__(self): super().__init__() self.blind_spot_indicators = BlindSpotIndicators() - self._joystick_overlay = JoystickDebugOverlay() def _update_state(self) -> None: super()._update_state() @@ -64,7 +22,6 @@ class HudRendererSP(HudRenderer): def _render(self, rect: rl.Rectangle) -> None: super()._render(rect) self.blind_spot_indicators.render(rect) - self._joystick_overlay.render(rect) def _has_blind_spot_detected(self) -> bool: