From a6b7824b4e8b5b48b94f1e2c4177edd7ec4332b8 Mon Sep 17 00:00:00 2001 From: FrogAi <91348155+FrogAi@users.noreply.github.com> Date: Sat, 11 May 2024 14:50:36 -0700 Subject: [PATCH] Visuals - Model UI - Dynamic Path Width Have the path width dynamically adjust based on the current engagement state of openpilot. --- selfdrive/ui/ui.cc | 11 +++++++++++ selfdrive/ui/ui.h | 2 ++ 2 files changed, 13 insertions(+) diff --git a/selfdrive/ui/ui.cc b/selfdrive/ui/ui.cc index d25755f..989b7fe 100644 --- a/selfdrive/ui/ui.cc +++ b/selfdrive/ui/ui.cc @@ -111,6 +111,14 @@ void update_model(UIState *s, } // update path + float path; + if (scene.dynamic_path_width) { + float multiplier = scene.enabled ? 1.0f : scene.always_on_lateral_active ? 0.75f : 0.50f; + path = 0.9 * multiplier; + } else { + path = scene.path_width; + } + auto lead_count = model.getLeadsV3().size(); if (lead_count > 0) { auto lead_one = model.getLeadsV3()[0]; @@ -372,6 +380,9 @@ void ui_update_frogpilot_params(UIState *s) { bool radarless_model = params.get("Model") == "radical-turtle"; scene.lead_detection_threshold = longitudinal_tune && !radarless_model ? params.getInt("LeadDetectionThreshold") / 100.0f : 0.5; + scene.model_ui = params.getBool("ModelUI"); + scene.dynamic_path_width = scene.model_ui && params.getBool("DynamicPathWidth"); + bool quality_of_life_controls = params.getBool("QOLControls"); scene.reverse_cruise = quality_of_life_controls && params.getBool("ReverseCruise"); scene.reverse_cruise_ui = params.getBool("ReverseCruiseUI"); diff --git a/selfdrive/ui/ui.h b/selfdrive/ui/ui.h index e7fe0f2..8bf9091 100644 --- a/selfdrive/ui/ui.h +++ b/selfdrive/ui/ui.h @@ -198,6 +198,7 @@ typedef struct UIScene { bool conditional_experimental; bool disable_smoothing_mtsc; bool disable_smoothing_vtsc; + bool dynamic_path_width; bool dynamic_pedals_on_ui; bool enabled; bool experimental_mode; @@ -215,6 +216,7 @@ typedef struct UIScene { bool lead_info; bool live_valid; bool map_open; + bool model_ui; bool numerical_temp; bool online; bool onroad_distance_button;