From c71a12f56f2f6de61c136ee0027a6228274b6b78 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 2fae344d5..6cd04fad8 100644 --- a/selfdrive/ui/ui.cc +++ b/selfdrive/ui/ui.cc @@ -114,6 +114,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]; @@ -392,6 +400,9 @@ void ui_update_frogpilot_params(UIState *s, Params ¶ms) { bool model_manager = params.getBool("ModelManagement"); scene.model_randomizer = model_manager && params.getBool("ModelRandomizer"); + 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 d7f27c1d4..f9d3183ed 100644 --- a/selfdrive/ui/ui.h +++ b/selfdrive/ui/ui.h @@ -134,6 +134,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; @@ -152,6 +153,7 @@ typedef struct UIScene { bool live_valid; bool map_open; bool model_randomizer; + bool model_ui; bool numerical_temp; bool online; bool onroad_distance_button;