From 14eacb8b3baddc15d8d1a91dbd3bf01a862b3812 Mon Sep 17 00:00:00 2001 From: FrogAi <91348155+FrogAi@users.noreply.github.com> Date: Wed, 10 Apr 2024 18:41:16 -0700 Subject: [PATCH] Acceleration path Added toggle to always show the vehicle's acceleration/deceleration via the onroad UI path. --- common/params.cc | 1 + selfdrive/frogpilot/ui/qt/offroad/visual_settings.cc | 4 ++-- selfdrive/ui/qt/onroad.cc | 2 +- selfdrive/ui/ui.cc | 1 + selfdrive/ui/ui.h | 1 + 5 files changed, 6 insertions(+), 3 deletions(-) diff --git a/common/params.cc b/common/params.cc index 7824a4583..80d534864 100644 --- a/common/params.cc +++ b/common/params.cc @@ -209,6 +209,7 @@ std::unordered_map keys = { {"Version", PERSISTENT}, // FrogPilot parameters + {"AccelerationPath", PERSISTENT}, {"CustomAlerts", PERSISTENT}, {"CustomPaths", PERSISTENT}, {"CustomUI", PERSISTENT}, diff --git a/selfdrive/frogpilot/ui/qt/offroad/visual_settings.cc b/selfdrive/frogpilot/ui/qt/offroad/visual_settings.cc index 14d70b3a5..b396896f2 100644 --- a/selfdrive/frogpilot/ui/qt/offroad/visual_settings.cc +++ b/selfdrive/frogpilot/ui/qt/offroad/visual_settings.cc @@ -37,8 +37,8 @@ FrogPilotVisualsPanel::FrogPilotVisualsPanel(SettingsWindow *parent) : FrogPilot }); toggle = customUIToggle; } else if (param == "CustomPaths") { - std::vector pathToggles{}; - std::vector pathToggleNames{}; + std::vector pathToggles{"AccelerationPath"}; + std::vector pathToggleNames{tr("Acceleration")}; toggle = new FrogPilotParamToggleControl(param, title, desc, icon, pathToggles, pathToggleNames); } else if (param == "QOLVisuals") { diff --git a/selfdrive/ui/qt/onroad.cc b/selfdrive/ui/qt/onroad.cc index 3d493548c..dd807f9ad 100644 --- a/selfdrive/ui/qt/onroad.cc +++ b/selfdrive/ui/qt/onroad.cc @@ -502,7 +502,7 @@ void AnnotatedCameraWidget::drawLaneLines(QPainter &painter, const UIState *s) { // paint path QLinearGradient bg(0, height(), 0, 0); - if (experimentalMode) { + if (experimentalMode || scene.acceleration_path) { // The first half of track_vertices are the points for the right side of the path // and the indices match the positions of accel from uiPlan const auto &acceleration = sm["uiPlan"].getUiPlan().getAccel(); diff --git a/selfdrive/ui/ui.cc b/selfdrive/ui/ui.cc index 1f5f2b4dd..084282b57 100644 --- a/selfdrive/ui/ui.cc +++ b/selfdrive/ui/ui.cc @@ -252,6 +252,7 @@ void ui_update_frogpilot_params(UIState *s) { bool custom_onroad_ui = params.getBool("CustomUI"); bool custom_paths = custom_onroad_ui && params.getBool("CustomPaths"); + scene.acceleration_path = custom_paths && params.getBool("AccelerationPath"); bool quality_of_life_controls = params.getBool("QOLControls"); diff --git a/selfdrive/ui/ui.h b/selfdrive/ui/ui.h index 776fd77d7..ead6da621 100644 --- a/selfdrive/ui/ui.h +++ b/selfdrive/ui/ui.h @@ -169,6 +169,7 @@ typedef struct UIScene { uint64_t started_frame; // FrogPilot variables + bool acceleration_path; bool enabled; bool experimental_mode; bool map_open;